首页 > 代码库 > sql删除重复数据

sql删除重复数据

 

 

begin tran delete from WxUser_BMUser  where   OpenId in (  select a.OpenId from WxUser_BMUser a where  IsUnBind=0group 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) rollbackcommit

 

sql删除重复数据