ITeye博客

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

liomao · 2010-05-21 19:47 · Java 基础 · 数据库 · MySQL · Markdown

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

 

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;

 

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。