I have this 2 tables:Table1: Table2:ID Value ID Value--------- ---------1 2 2 12 1 3 44 3 4 4
I need to find all differences between the 2 Tables.A mismatch can be:- Table1.ID exists, Table2.ID does not exist- Table2.ID exists, Table1.ID does not exist- Table1.ID = Table2.ID and Table1.Value <> Table2.ValueSo I want to be returned:ID Value ID Value--------------------1 2 NULL NULL4 3 4 4NULL NULL 3 4
There must be something simpler than the solution I came up with which is:select * from Table1 a full outer join Table2 b on a.Id = b.IdWHERE a.value <> b.value or (a.value IS NULL and b.value IS NOT NULL) or (a.value IS NOT NULL and b.value IS NULL)
Martin