Many-to-many relationship query question...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi - I have a query question that I hope someone would have some insight on.
I have the three tables shown below with the following fields:

tblContacts: NameID, Name
tblContactsCategories: NameID, CategoryID
tblCategories: CategoryID, Category

It's a simple many-to-many relationship between contact names and categories
I can group them in. Is there a way to make a query staement that basically
will list out contacts that don't belong to any categories (i.e. contacts
from tblContacts that are not in tblContactsCategories)?

Thanks so much for any ideas -

Dan
 
Dan said:
Hi - I have a query question that I hope someone would have some insight on.
I have the three tables shown below with the following fields:

tblContacts: NameID, Name
tblContactsCategories: NameID, CategoryID
tblCategories: CategoryID, Category

It's a simple many-to-many relationship between contact names and categories
I can group them in. Is there a way to make a query staement that basically
will list out contacts that don't belong to any categories (i.e. contacts
from tblContacts that are not in tblContactsCategories)?


SELECT tblContacts.NameID, tblContacts.Nane
FROM tblContacts LEFT JOIN tblContactsCategories
On tblContacts.NameID = tblContactsCategories.NameID
WHERE tblContactsCategories.NameID Is Null

This should be what you get by using the unmatched query
wizard.
 
Great, thanks so much! I knew it could be done - just couldn't find out how.
I really appreciate your help!
 
Back
Top