MySQL query to find unmapped result
The question title is a little bit vague as I don't know how to explain it
briefly.
I have 3 tables:
Project (projectid, name, description)
Person(personid, name, description)
ProjectPerson(projectid, personid)
Project and Person has a many to many relationship through ProjectPerson
table
I want to create an SQL Query to find all persons that is not in any Project.
I have a solution: get all persons, get all entries in ProjectPerson and
remove person entries that exist in ProjectPerson.
However it seems a little bit stupid. Could anyone advise me a better way?
Thanks in advance
No comments:
Post a Comment