sql删除重复数据

Posted 帅就一个字却跟我一辈子

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql删除重复数据相关的知识,希望对你有一定的参考价值。

 

 

begin tran 
delete from WxUser_BMUser  
where   OpenId in (  select a.OpenId from WxUser_BMUser a where  IsUnBind=0
group by a.OpenId having COUNT(1)>1
) 
and   id not in (select min(id) from WxUser_BMUser  where IsUnBind=0  group by OpenId     having count(1)>1) 

rollback
commit

 

以上是关于sql删除重复数据的主要内容,如果未能解决你的问题,请参考以下文章