处理这种问题有很多种方法,首先是要在建表的时候尽量杜绝
这种数据的产生,其次才是如何删除重复的数据:
最简单的方法是先给每行数据加个唯一标识,
alter table vTable
add SeqNo numeric identity(1,1)
然后就可以操作了
delete vTable
from vTable a
where exists(select 1 from vTable b
where b.SeqNo > a.SeqNo and b.Id = a.Id and b.Name = a.Name
and b.Description = a.Description)
当然,方法很多,这只是其中的一种而已.
这种数据的产生,其次才是如何删除重复的数据:
最简单的方法是先给每行数据加个唯一标识,
alter table vTable
add SeqNo numeric identity(1,1)
然后就可以操作了
delete vTable
from vTable a
where exists(select 1 from vTable b
where b.SeqNo > a.SeqNo and b.Id = a.Id and b.Name = a.Name
and b.Description = a.Description)
当然,方法很多,这只是其中的一种而已.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货