Posted on 2008-02-01 23:21
leekiang 閱讀(397)
評論(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秒,有點慢。可改用上面鏈接里講的建臨時表的方式。