一条话语,删除mysql表的重复数据

一条语句,删除mysql表的重复数据

在网上看到的,觉得有必要记录下。

 

delete students as a from students as a,
(select * from students group by name having count(1)>1) as b
where a.name=b.name and a.id > b.id;

 

达到了效果,就不知道效率如何。如果有更加好的方法,请赐教,不胜感激!