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 |
chiragvm
Yak Posting Veteran
65 Posts |
Posted - 2012-01-23 : 06:44:25
|
hi to all i have 2 table Table_A and Table_BSelect * from Table_A-----------------------------------Id -------- AtId ------ rid----------- ----------- -----------1 --------- 11 --------- 02 --------- 12 --------- 223 --------- 12 --------- 234 --------- 13 --------- 24(4 row(s) affected)Select * from Table_B----------------------------------------------------id -------- AtId ------ Rid -------- Name----------- ----------- ----------- ----------------1 --------- 11 -------- 0 --------- Chirag2 --------- 12 -------- 22--------- Karan(2 row(s) affected)now i want a select Query on Table_A table get those records will not in Table Bcompare Atid and Rid both result is-----------------------------------Id -------- AtId ------ rid----------- ----------- -----------3 --------- 12 -------- 234 --------- 13 -------- 24result i know but don't know how to build a query |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-01-23 : 07:01:03
|
By TID did you mean Atid or Id? Assuming it is Atid,select * from Table_A awhere not exists( select * from Table_B b where a.rid = b.rid and a.AtId = b.Atid); |
 |
|
chiragvm
Yak Posting Veteran
65 Posts |
Posted - 2012-01-23 : 07:30:59
|
quote: Originally posted by sunitabeck By TID did you mean Atid or Id? Assuming it is Atid,select * from Table_A awhere not exists( select * from Table_B b where a.rid = b.rid and a.AtId = b.Atid);
hi Sunitabeckthanks a lot for this query |
 |
|
|
|
|