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)
 Compare problem

Author  Topic 

Tks
Starting Member

48 Posts

Posted - 2005-12-20 : 16:04:42
Hi people,

maybe my creativty is an bit down on the moment,

but how could i show the difference between 2 tables if both contain the same id.

For example i have products and i have an sold table an di want a list of products never sold..:D

etc..

i tried with join etc. but they always show the HIT 2..

whats the trick??

Tks

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2005-12-20 : 16:25:03
Select * from Product where ProductCode Not In (Select ProdCode from Sold)
Go to Top of Page

Tks
Starting Member

48 Posts

Posted - 2005-12-20 : 16:27:15
Yeah or: SELECT *
FROM Products LEFT OUTER JOIN
Printlog ON Products.Id = Printlog.prodid
WHERE (Printlog.prodid IS NULL)

with other words use the outer join on the side where you need its empty you search for 1 Null column..
Go to Top of Page
   

- Advertisement -