Assuming I have 3 tables:
People
-------------
PID | NAME
-------------
1 Bob
2 Garry
3 Alex
4 Peter
5 Victor
Tasks
-------------
TID | TASK
-------------
1 Work
2 Work Hard
3 Work Harder
And table that assigns tasks to people
Assigns
-------------
PID | TID
-------------
1 2
2 1
4 3
Question:
How do I select People who were not assigned to any task?
The
LEFT JOINapproach will work, but here are two more approaches that you might find easier to read:1. NOT IN
2. NOT EXISTS
Result
Related