MYSQL query to return rows that are NOT in a set
- by iglurat
Hi,
I have two tables:
Contact (id,name)
Link (id, contact_id, source_id)
I have the following query which works that returns the contacts with the source_id of 8 in the Link table.
SELECT name FROM `Contact` LEFT JOIN Link ON Link.contact_id = Contact.id WHERE Link.source_id=8;
However I am a little stumped on how to return a list of all the contacts which are NOT associated with source_id of 8. A simple != will not work as contacts without any links are not returned.
Thanks.