Sql Server重复数据删除

--在sql2005下可以 ,sql2000不可以

 create  table tb(id int,name varchar(4))
insert tb select 1,'aa'
union all select 1,'aa'
union all select 2,'bb'
union all select 3,'bb'
union all select 4,'cc'
union all select 1,'aa'
union all select 4,'cc'


delete a from 
 (select id,name,rn=row_number() over(partition by id,name order by id) from tb) a where rn>1
select * from tb

原文:http://blog.csdn.net/hzvcan/article/details/4862927

你可能感兴趣的:(SQL Server)