Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Selecting multiple columns in a sub-select, with a NOT IN clause

514950Feb 3 2009 — edited Feb 5 2009
Hi, 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 5 2009
Added on Feb 3 2009
3 comments
12,351 views