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 |
|
Milo Cold
Starting Member
14 Posts |
Posted - 2005-06-24 : 18:52:18
|
| Greetings,I'm dealing with 2 tables: Original Table and New Table. The sturctures are the same, they have 3 columns all of which are used as the primary key. (is that called a compound key? or complex key?) What I'd like to do is compare the orignal table against the New table and find records that aren't in the new table, thus can be deleted from the original table. However, I can't -- for the life of someone else's -- get this to work out right.All the other similar queries I've done only had one PK so I was able to use: *blank* NOT IN (SELECT ...) But I guess I can't use that with multiple columns.Any advice,M.Cold |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2005-06-24 : 19:45:29
|
| [Code]delete OriginalTablefrom OriginalTable o left outer join NewTable n on o.Field1 = n.Field1 and o.Field2 = n.Field2 and o.Field2 = n.Field3where n.Field1 is Null and n.Field2 is Null and n.Field3 is Null[/Code]HTH================================================================='Tis with our judgements as our watches: none Go just alike, yet each believes his own. -Alexander Pope, poet (1688-1744) |
 |
|
|
Milo Cold
Starting Member
14 Posts |
Posted - 2005-06-24 : 21:10:17
|
| Thank you to the nth degree man!! I didn't even think of using the WHERE clause in a JOIN. Doh!Much Recpect,M. Cold |
 |
|
|
|
|
|