转 sql 查出一张表中重复的所有记录数据

 

select * from DB_PATCH a
where lower(a.db_name) in (select lower(db_name) from DB_PATCH group by lower(db_name) having count(*) > 1)

delete from DB_PATCH a
where lower(a.db_name) in (select lower(db_name) from DB_PATCH group by lower(db_name) having count(*) > 1)
and rowid not in (select min(rowid) from DB_PATCH group by lower(db_name) having count(*) > 1)

 

http://blog.csdn.net/a11085013/article/details/8549256

 

posted @ 2017-08-22 13:57  feiyun8616  阅读(140)  评论(0编辑  收藏  举报