oracle删掉重复数据的语法

--查询重复数据--
SELECT XYH,COUNT(*) FROM BGJL GROUP BY XYH having(count(*)>1) 

--删掉重复数据--
DELETE from BGJL WHERE (XYH) IN ( SELECT XYH FROM BGJL GROUP BY XYH HAVING COUNT(XYH) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM BGJL GROUP BY XYH HAVING COUNT(*) > 1);

 

posted @ 2015-08-04 11:05  韩梦芫  阅读(257)  评论(0编辑  收藏  举报