在CSDN上找到解决方案, 对线上的数据库尽量不要执行删除操作,无论对线上的数据库有任何操作都应该先备份数据库
--删除重复的记录
delete from table1
--根据Uid号获取重复的记录
where uid in (select uid from table1 group by uid having count(uid) > 1)
--排除保留最新的ID号,其他的删除
and id not in (select max(id) from table1 group by uid having count(uid )>1)
参考: