Posted on 2008-02-01 23:21
leekiang 阅读(390)
评论(0) 编辑 收藏 所属分类:
oracle
查找重复数据
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秒,有点慢。可改用上面链接里讲的建临时表的方式。