delete abc where (c1,c2,c3) in (select c1,c2,c3 from abc group by c1,c2,c3 having count(*)>1) and rowid not in
(select min(rowid) from abc group by c1,c2,c3 having count(*)>1);
Oracle 中删除多条一样的数据(只剩下一条数据,根据伪列查询);
本文介绍了一种在Oracle数据库中删除重复记录的方法,通过使用伪列ROWID和分组函数确保每组重复的数据只保留一条。具体操作是通过DELETE语句结合子查询实现,子查询中利用GROUP BY和HAVING条件过滤出重复的记录。
delete abc where (c1,c2,c3) in (select c1,c2,c3 from abc group by c1,c2,c3 having count(*)>1) and rowid not in
(select min(rowid) from abc group by c1,c2,c3 having count(*)>1);
Oracle 中删除多条一样的数据(只剩下一条数据,根据伪列查询);
4173

被折叠的 条评论
为什么被折叠?