Hi all I am trying to figure out how to do this in one query.
Using MySQL 2.3.58 Tables (only relevant data shown) Categories: id=int 11 primary key title = varchar Products: id=int 11 primary key name=varchar Lnk: catid=int11 primary key lnk=int 11 (key: unique combo catid+lnk) Id's for categories are between 20001 and 25000 id's for products are <20000 I want to select all products that do not have a link to category x in the table Lnk. Example Categories: id title 20001 Network 20002 Switches Products id name 1 10/100 Switch 5 port 2 10/100 Switch 8 port 3 10/100/1000 Switch 5 port Lnk catid lnk 20001 20002 20002 1 With this data, when using the category 20002, the query should return products with id 2, and 3. If used with category 20001, it should return products with id 1, 2, and 3 I was thinking on using three left joins but have been unable to make working code. Can anybody make sense to this? With kind regards Andy -- Registered Linux User Number 379093 -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- --
pgp1iOh1e0zGI.pgp
Description: PGP signature