mysql删除表中重复数据,只保留一个最小的id的记录

语句:

delete from 表名 where id not in (select minid from (select min(id) as minid from 表名 group by 字段名) b);

猜你喜欢

转载自www.cnblogs.com/zrmw/p/9920981.html