Oracle根据字段去除表中重复数据

根据MOBILE查询SY_WXUSER表中的重复数据:

select * from SY_WXUSER
where MOBILE in (select   MOBILE from   SY_WXUSER group by   MOBILE having count (MOBILE) > 1)

根据MOBILE删除SY_WXUSER表中的重复数据:

delete from SY_WXUSER 
where MOBILE in (select   MOBILE from SY_WXUSER group by   MOBILE   having count (MOBILE) > 1) 
and rowid not in (select min(rowid) from   SY_WXUSER group by MOBILE having count(MOBILE)>1)
发布了50 篇原创文章 · 获赞 85 · 访问量 161万+

猜你喜欢

转载自blog.csdn.net/qq_24347541/article/details/90638278