[PHP] RE: the opposite of a join?

2007-10-03 Thread jd.pillion
> Hi J, > > > Checkout this, > > > SELECT * FROM tbl_company where id not in (SELECT companyID from > tbl_contacts) > Brilliant! This is exactly what I was looking for, and is quite logical/readable! Thanks to everyone for the ideas! J > > > > > Regards, > Lasitha Alawa

[PHP] the opposite of a join?

2007-10-03 Thread jd.pillion
I have a company table and a contacts table. In the contacts table, there is a field called "companyID" which is a link to a row in the company table. What is the easiest way to query the company table for all the company rows whose ID is NOT linked to in the contact table? Basically, the oppo