I have three tables, one table, vendors, holds a vendor name and an id, the second table, vendorlinks, has two columns vendorID and pageID, the id in vendors has the same value as vendorID in vendorLinks, and the third table page has the column page id which matches up to pageID in vendorlinks.
So basically I have a type of multiple pages correspond to multiple vendors system, and I need to display a page that contains all the pages that correspond to the vendor but also have pageIDs that correspond to the pages table pageId column, as not all entries in vendorlink correspond to a particular page entry.
What I need is a sql statement that will probably look something like this
'SELECT * FROM VendorLink Where vendorID = :venId And' pageId matches with ID IN pages table
That last part is what I don't know how to do. Any help is alwaya aprreciated.
Nevermind everyone i solved it here's my solution i fanyone is interested:
'SELECT * FROM VendorLink Where vendorID = :venId AND pageID IN (SELECT id FROM Pages)''
you be missing a table in there
Oh no, im calculating the vendor id with another statement, since there is also other information I need to get from that table.
It's great that you solved your own problem, but I have to admit, this requirement baffles me a bit. How could you have a vendorLink pageID that doesn't correspond to a page entry? Where did the value of the pageID even come from if there's no corresponding page?
Users are allowed submit pages which we keep in a seperate tablebefore confirmation, so when we display pages that pertain to a certain vendor we want to make sure there is no evidence of another page linking to that vendor, that we don't show.
This topic is now archived. It is frozen and cannot be changed in any way.