Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Workaround of NOT IN limitation w/ multi cols?

Author  Topic 

Lucy
Starting Member

4 Posts

Posted - 2005-09-19 : 04:30:32
Hi,

Does anyone have some ideas on how to get around the limitation of NOT IN when using multiple columns.
Basically, I would like to find out the difference between two tables
over several columns:

select a, b, c from table1
where
a, b, c NOT in (select a, b, c from table2)

Thank you,
Lucy

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-09-19 : 04:33:17
how about using join?

--------------------
keeping it simple...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-19 : 04:59:00
Try this

select a, b, c from table1 T1
where not exists
(select T2.a, T2.b, T2.c from table2 T2 where T1.a=T2.a and T1.b=T2.b and T1.c=T2.c)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Lucy
Starting Member

4 Posts

Posted - 2005-09-19 : 18:36:42
Hi All,

Thanks a lot for the prompt replies.
I've implemented my query using join as advised
and it works as expected.

Lucy

Go to Top of Page
   

- Advertisement -