假定你的重复的记录是完全相同的,除了一个自动增加的字段,如果没有自动增加的字段,首先修改结构加上这个字段,以利于下面的操作。
假定这个自增字段名称为ID,主键为Code
delete from table where id not in (select min(ID) from table group by code)
如果添加了自增字段,请删除。
顺便说一句,你这个人太大方了,居然开出了0分的天价!!!!
假定这个自增字段名称为ID,主键为Code
delete from table where id not in (select min(ID) from table group by code)
如果添加了自增字段,请删除。
顺便说一句,你这个人太大方了,居然开出了0分的天价!!!!
假定这个自增字段名称为ID,Code为标示性字段(不好表达了,恢复完了发现这个地方表达的不对)
delete from table where id not in (select min(ID) from table group by code)
如果添加了自增字段,请删除。
turncate tb
select * into tb from #t
drop table #t