mysql 查找出重复数据 然后把删除重复的数据 保留一条

2024-11-23 14:56:30
推荐回答(2个)
回答1:

delete from temp where id in (select id from (select max(id) as id,count(url) as count from temp group by url having count >1 order by count desc) as tab )

回答2:

用distinct把所有不重复的数据导出,然后清空表,重新导入刚才的数据。