navicat中查重并删除
Posted kend
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了navicat中查重并删除相关的知识,希望对你有一定的参考价值。
# 查询所有重复的数据
SELECT * FROM hao123 WHERE ir_url IN
(SELECT ir_url FROM `hao123` GROUP BY ir_url having count(ir_url)>1)
# 把查询出来的重复行删除 DELETE FROM `hao123` WHERE ir_url IN (SELECT ir_url FROM (SELECT ir_url FROM `hao123` GROUP BY ir_url having count(ir_url)>1)a) AND ir_id NOT IN (SELECT * FROM (SELECT min(ir_id) FROM `hao123` GROUP BY ir_url HAVING count(ir_url)>1)b);
以上是关于navicat中查重并删除的主要内容,如果未能解决你的问题,请参考以下文章