Say I have a query such as:
SELECT *
FROM Table_1
JOIN Table_2
ON Table_1.Col_1 = Table_2.Col_1
So I have 100 records and 98 of them are equal so that query would print out 98 out of 100. How can I get SQL to print the 2 that failed to meet the join?
Use a
LEFT JOIN:The fields of
Table_2will be NULL where there was no match for theONclause. You’ll then be able to add aWHERE TABLE_2.Col_1 IS NULLto keep only records inTable_1that didn’t have a match inTable_2.