首页 > 数据库 > Oracle > 查找/删除重复的数据(单个字段和多个字段条件)
select t.*from test1108 twhere t.tid in (select tidfrom test1108group by tidhaving count(tid) > 1);
delete from test1108 twhere t.tid in (select tidfrom test1108group by tidhaving count(tid) > 1)and rowid not in (select min(rowid)from test1108group by tidhaving count(tid) >1);
select * from test112101 twhere (t.tid,t.tname) in (select tid,tnamefrom test112101 t1group by t1.tid,t1.tname having count(*) >1);
delete from test112101 twhere (t.tid,t.tname) in (select tid,tnamefrom test112101 t1group by t1.tid,t1.tname having count(*) >1)and rowid not in(select min(rowid) from test112101group by tid,tname having count(1)> 1);
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30345407/viewspace-2735848/ ,如需转载,请注明出处,否则将追究法律责任。