You can create a temp_table to store the most updated information > truncate the original one, and once u get the new information > insert to the original table
use test
create table temp_table
(
id int identity(1,1),
name nvarchar(50),
lastUpdateDate datetime
)
insert into temp_table
select distinct name,max(LastUpdateDate)as LastUpdate from org_table
group by name
truncate table org_table
insert into org_table
select * from temp_table
drop table temp_table
[ 本帖最後由 rocketdive04 於 2008-10-20 16:43 編輯 ] |