删除数据库重复数据

2014-11-24 09:53:24 · 作者: · 浏览: 0

delete from tablename where id not in (select max(id) from tablename group by column1,column2...)

其中tablename为要操作的表,id为假设的表中某一唯一字段,column1~2...为表中的列,关键是group by

还可以间隔临时表,但是那样就太麻烦,复杂了!

摘自 swazer_z的专栏