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 2005 Forums
 Transact-SQL (2005)
 Select statement

Author  Topic 

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-09-25 : 04:53:50
Hi,

How to select all data from tableA where Rec_no and Test_no not in tableB, where Rec_no and Test_no are the primary key in tableA and foreign key in tableB.

Thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-25 : 05:00:24
[code]SELECT a.*
FROM TableA a
LEFT JOIN TableB b
ON b.Rec_no =a.Rec_no
AND b.Test_no=a.Test_no
WHERE b.Rec_no IS NULL
AND b.Test_no IS NULL[/code]
Go to Top of Page
   

- Advertisement -