问题描述:
mysql某张表中存在多个重复数据,目的去重;
demo表:
原因分析:
在做爬虫时,针对重复数据已经入库,想使用个简单的sql直接去重。
解决方案:
delete from demo where title in (select bt from (select demo.title bt from demo group by demo.title having COUNT(demo.title)>1) as t)
and id not in (select mid from(select min(id) mid from demo group by title having count(demo.title)>1) as tt)
最后好好琢磨一下掌握就可以了;