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

posted @ 2014-12-11 13:30  尼玛范爷  阅读(227)  评论(0编辑  收藏  举报