时间:2021-07-01 10:21:17 帮助过:16人阅读
select name,sex,count(*) from test group by name,sex HAVING count(*)>1。
delete a from test a join
(select name,sex,count(*) ,max(id) as id
from test group by name,sex
HAVING count(*)>1) b on a.name=b.name where a.id<b.id
mysql如何删除重复数据并保留ID最大的数据
标签:16px having group by name join style rom test from