SQL Server中删除重复数据

delete from A
where UserName in (select UserName from A group by UserName having count(UserName)>1)
and UserID not in (select min(UserID) from A group by UserName having count(UserName)>1)
View Code

 

posted @ 2016-11-03 10:07  Aquaris  阅读(242)  评论(0编辑  收藏  举报