22,209
社区成员
发帖
与我相关
我的任务
分享
DELETE t FROM (SELECT *,row=ROW_NUMBER() OVER (PARTITION BY id ORDER BY GETDATE()) FROM oldpersoninfo)t
WHERE t.row>1
select distinct * into #t from tb
delete from tb -- truncate 不产生LOG,建议用delete
insert into tb select * from #t
drop table tb
select distinct * into #t from tb
truncate table tb
insert into tb select * from #t
drop table tb