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 |
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2014-10-10 : 12:57:09
|
table1: subaccttable2 : subacctis this the proper way to get the not found subacct'sselect distinct subacct from table1 where subacct not in (select subaccts from table2)Thanks a lot for the helpful info. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-10-10 : 13:15:40
|
I would use NOT EXISTS or LEFT JOIN/IS NULLselect subacct from table1 where not exists (select * from table2 where table1.subacct = table2.subacct)Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-10-10 : 13:16:19
|
select table1.subacct from table1 left join table2on table1.subacct = table2.subacctwhere table2.subacct is nullTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|