前言:
而今看官们对“oracle导入重复数据”大概比较注重,小伙伴们都想要知道一些“oracle导入重复数据”的相关文章。那么小编同时在网上网罗了一些对于“oracle导入重复数据””的相关资讯,希望朋友们能喜欢,姐妹们快快来学习一下吧!我们在使用数据库的时候,有时数据会有所重复,当我们只需要一项数据时,不需要显示重复的记录时,就可以用以下SQL代码:
--查找表中多余的重复记录,重复记录是根据单个字段来判断select * from people where peopleId in(select peopleId from people group by peopleIdhaving count(peopleId)>1);--删除表中多余的重复记录,重复记录是根据单个字段来判断,只保留rowid最小的记录delete from people where peoplename in(select peoplename from people group by peoplename having count(peoplename)>1)and peopleId not in (select min(peopleId) from people group by peoplename having count(peoplename)>1);--查找表中多余的重复记录(多个字段)select * from vitae awhere (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*)>1);--删除表中多余的重复记录(多个字段),只保留rowid最小的记录delete from vitae awhere (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*)>1)and rowid not in(select min(rowid) from vitae group by peopleId,seq having count(*)>1);
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #oracle导入重复数据