SELECT DISTINCT a.ID FROM Contacts a, AccountsContacts b WHERE a.ID = b.ContactID AND b.AccountID NOT IN (<account id here>);
Should give you a list of all the contacts that are not linked to the specified account(s).
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
Can you post small examples of the tables, and what you want the output to be? Maybe I'm just not understanding what you are trying to do.
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
SELECT DISTINCT ID FROM Contacts
WHERE ID NOT IN (SELECT DISTINCT ContactID FROM AccountContacts
WHERE LocationID = <location id>);
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558