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
 General SQL Server Forums
 New to SQL Server Programming
 getting difference in two tables

Author  Topic 

tpiazza55
Posting Yak Master

162 Posts

Posted - 2008-09-09 : 14:51:12
I have 2 tables salesmade and salestotal

I have a field called salesID in both tables

How do I find out which distinct salesid are in table1 but not in table2

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2008-09-09 : 15:14:57
In it's most simplistic form:

select distinct salesID from salesmade where salesID not in (select salesID from salestotal)

BTW - is this homework??

Terry
Go to Top of Page
   

- Advertisement -