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.
Author |
Topic |
pug2694328
Posting Yak Master
166 Posts |
Posted - 2006-08-21 : 15:47:27
|
Are there any other ways to pull rows where a unique key is on a row in table A , but not in a row in table B? Here is how I know how to do it, but am wondering if there are any other ways. Thanks in advance!-- Way 1SELECT *FROM TABLE_A AWHERE NOT EXISTS ( SELECT NULL FROM TABLE_B B WHERE A.KEY = B.KEY )SELECT *FROM TABLE_A A LEFT JOIN TABLE_B B ON A.KEY = B.KEYWHERE B.KEY IS NULL |
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-08-21 : 16:02:17
|
May be this is more inefficient-- Way 3SELECT *FROM TABLE_A AWHEREA.Key Not in (SELECT B.KEYFROM TABLE_B B) Srinika |
|
|
|
|
|