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 |
|
goligol
Posting Yak Master
128 Posts |
Posted - 2011-07-28 : 12:50:28
|
| I have table A and table B,I want to see the records in table B which are not in table A:select B.*from dev.xListOfChildrenOffile25 B,dev.xListOfChildrentAlList Awhere not (B.O = A.Oand B.D = A.Dand B.M = A.Mand B.C = A.C)But it does not return correct records. |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-07-28 : 12:54:55
|
If those are the only columns in your table (and if you are on SQL 2005 or higher, you can use the EXCEPT keyword:select * from dev.xListOfChildrenOffile25EXCEPTselect * from dev.xListOfChildrentAlList If there are more columns, you can list the columns that you want to compare instead of using the *. |
 |
|
|
goligol
Posting Yak Master
128 Posts |
Posted - 2011-07-28 : 13:28:43
|
| Thank you. it works:) |
 |
|
|
|
|
|