Selecting multiple columns in a sub-select, with a NOT IN clause
514950Feb 3 2009 — edited Feb 5 2009Hi, all. I'm just hoping for a quick syntax tip.
I have two tables, with two different months' versions of a specific data set.
What is important to me with this data is combinations of two specific columns.
I am trying to determine what is different between these tables, in the context of these two columns. Specifically, if one table has combinations of the values in these columns that the other table does not.
So basically, in clumsy pseudoSQL:
SELECT COL_A, COL_B FROM NEW_TABLE WHERE (COL_A, COL_B) NOT IN (SELECT COL_A, COL_B FROM OLD_TABLE)
And I'm getting relational operator errors. I'm not particularly surprised at that, but am not sure what the correct syntax would be for this - it's the NOT IN that's throwing me off, because NEW_TABLE.COL_A can exist in OLD_TABLE, and NEW_TABLE.COL_B can exist in OLD_TABLE, but the combinations of COL_A and COL_B that exist in one table but not the other are what I'm interested in...
Any suggestions are appreciated!
DW