MySql查找重复数据并保留一条记录
查询重复记录
select * From 表名 where 重复字段 In (select 重复字段 From 表 Group By 重复字段 Having Count(*) > 1) order by 重复字段 desc
删除重复数据保留一条
delete from 表名 where id not in (select id from (select min(id) AS id from 表名 group by 重复字段) a )
不忘初心