查找重复数据
select count(*), id from test group by id having count(id) > 1
详见
http://www.cnblogs.com/shw0315/articles/305959.html
例子:登录日志表里有128794条记录,执行以下sql
delete from test a where a.rowid !=
( select max(b.rowid) from test b where a.id = b.id )
共删掉3471条,用时12617秒,有点慢。可改用上面链接里讲的建临时表的方式。
select count(*), id from test group by id having count(id) > 1
详见
http://www.cnblogs.com/shw0315/articles/305959.html
例子:登录日志表里有128794条记录,执行以下sql
delete from test a where a.rowid !=
( select max(b.rowid) from test b where a.id = b.id )
共删掉3471条,用时12617秒,有点慢。可改用上面链接里讲的建临时表的方式。