Traditional left-join returns all records from the left table, including matching records:
I want to use the join to exclude matching records, and return only non-matching records from the left table:
Shown below, is the code I came up with so far.
It uses a WHERE
clause to weed out matching records - but this feels wrong somehow.
Is this the best way to do this? Or is there a better method of exclusive joining?
SELECT L.col1 ,
L.col2 ,
FROM leftTable L
LEFT JOIN rightTable R ON R.col1 = L.col1
WHERE R.id IS NULL ;