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 |
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2010-07-21 : 05:13:01
|
There are two tables A and B. They are the same structure. A alwaays has more records than B. How to code to find out different records in A (both them are set ID as primary key) and then save into a temp table? |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-21 : 05:19:28
|
select t1.* from A as t1 where not exists(select * from B as t2 where t1.Id=t2.Id)MadhivananFailing to plan is Planning to fail |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-07-21 : 05:19:32
|
[code]insert into < temp table > ( <columns > )select <columns > from tablea awhere not exists (select * from tableb b where b.ID = a.ID)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-07-21 : 05:20:08
|
 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|