delete a.*
from t as a,
(select * from t group by name having count(1)>1) as b
where a.name=b.name
and a.id>b.id;
count函数是用来统计表中记录数
count(1)和count(*)的区别
1.count(1)和count(*)的作用:
都是检索表中所有记录的行的数目,不论其是否包含null值。
2.区别:但是count(1)比count(*)效率更高
二.count(字段)与count(1)和count(*)的区别
count(字段)的作用是检索表中的这个字段的非空行数,不统计这个字段值为null的记录