Query of records that are not part of the join

samiuweb

Registered User.
Local time
Today, 21:21
Joined
Jun 18, 2003
Messages
18
Hi,
I have a database with one main table (Projects) and 3 other tables (Students, Organizations, Professors) linked to the main one through many-to-many relationships (through linking tables that is). Basically, the organization I work with does research projects, and each project could have many students (profs and organizations) associated with it, just as each student (prof or organization) could be associated with many separate projects.

Now, I need to develop a query that shows me only those organizations who are NOT linked to projects. I can easily figure out the opposite (organizations who are linked to projects) but I can't seem to do the former. Any ideas?
 
SELECT Organizations.*
FROM Organizations LEFT JOIN ProjectOrganizationLinkingTable ON [Organizations].[OrganizationID]=[ProjectOrganizationLinkingTable].[OrganizationID]
WHERE [ProjectOrganizationLinkingTable].[OrganizationID] Is Null;


You can also get a similar query using the Find Unmatched Query Wizard.
.
 
thanks, worked like a charm!
 

Users who are viewing this thread

Back
Top Bottom