SELECT *
FROM Table1 t1
INNER JOIN Table2 t2 ON t1.FK = t2.PK
WHERE t1.Name <> t2.Name
If any name values in Table2 are NULL then the SELECT will not return these records. Instead, we must explicitly handle the NULL values.
SELECT *
FROM Table1 t1
INNER JOIN Table2 t2 ON t1.FK = t2.PK
WHERE t1.Name <> t2.Name
OR t2.Name IS NULL
See also the blog by Michael Freidgeim.
No comments:
Post a Comment