mysql删除指定字段重复数据
删除表中name重复重复数据
查询语句:
select min(id) as id from user group by name;
错误删除语句:
delete from user where id not in (select min(id) as id from user group by name);
这个是知道无法这么更改的,方案临时表。。真不知道sql在嵌一层就可以了。尴尬
正确删除语句:
delete from user where id not in (select id from ((select min(id) as id from user group by name) tmp));