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 |
|
rnbguy
Constraint Violating Yak Guru
293 Posts |
Posted - 2007-02-28 : 19:43:11
|
| ive seen so many ways to do this, including some using cursors (strange i know)but i have tableA and tableB i want to show fields from tableA which don't apear in tableBwhat is the MOST efficient way to do this |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-02-28 : 20:27:24
|
[code]select *from tablea a left join tableb bon a.id = b.idwhere b.id is null[/code] KH |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2007-02-28 : 23:38:17
|
| select * from tablea a where a.id not in(select id from tableb)you can also use not exists. It depends on the nullability of your joins.As for efficiency - often they will end up with the same execution plan but you can use the query analyser to determine this. |
 |
|
|
|
|
|