mysql 查找重复数据,并且删除重复只保留一条数据
查找字段name重复数据
select `name`,count(*) as count from ak_supplier group by `name` HAVING count>1
删除字段name重复数据只保留一条
DELETE FROM ak_supplier WHERE Id NOT IN (SELECT Id FROM (SELECT MIN(Id) AS Id FROM ak_supplier GROUP BY `name`) t)