oracle 删除重复数据

1.找出重复数据

select count(1),uuid  from ts.test group by uuid having count(1)>1 order by 1 desc ;---找出重复数据


select * from ts.test E WHERE E.ROWID > (SELECT MIN(X.ROWID)
FROM ts.test x WHERE X.UUID=E.UUID AND E.TRAN_DT=X.TRAN_DT);---找出重复数据

2.删除重复数据

delete  from ts.test E WHERE E.ROWID > (SELECT MIN(X.ROWID) FROM ts.test x WHERE X.UUID=E.UUID AND E.TRAN_DT=X.TRAN_DT);----删除一条

--delete from ts.test where uuid='2f1cfa5b492d45a18c036400e4176e06';----删除2条!!!不建议使用

posted @ 2018-03-19 13:45  钱若梨花落  阅读(172)  评论(0编辑  收藏  举报