Friday, March 9, 2012

Getting non matching records from 2 tables?

If you have:

TBL1
field1 field2
a1-1 a1-2
a2-2 a2-2

&

TBL2
field1 field2
b1-1 b1-2
a2-2 a2-2

I want t get records from TBL2 that do not match in TBL1.field1 or TBL2.field1?
In this case i would get b1-1 from TBL2

Thanks allSELECT Field1
FROM Table2
WHERE (NOT (Field1 IN
(SELECT Field1
FROM Table1)))

No comments:

Post a Comment