How can I list all of the rows in table1 that do not have a corresponding record in table2?
If table1 contains employee data including a number, and table2 contains one or more records for each employee linked by the number, I need to list of employees with no records i.e. no records in table2 with that employee's number.
An intersection would do the trick (all numbers that appear in table1 but not in table2) but I'm unsure of the syntax
Here is a basic example of how it can be done:
SELECT t1.* FROM first_table as t1
LEFT JOIN second_table as t2
ON t2.table2_field = t1.table1_field
WHERE t2.table2_field IS NULL
I have adapted that and its what I wanted.
Thanks for the speedy response!