oracle刪除重復(fù)數(shù)據(jù)
Posted on 2008-02-01 23:21 leekiang 閱讀(398) 評(píng)論(0) 編輯 收藏 所屬分類: oracle查找重復(fù)數(shù)據(jù)
select count(*), id from test? group by id having count(id) > 1
詳見
http://www.cnblogs.com/shw0315/articles/305959.html
例子:登錄日志表里有128794條記錄,執(zhí)行以下sql
?delete from test a where a.rowid !=
?( select max(b.rowid) from test b where a.id = b.id? )
共刪掉3471條,用時(shí)12617秒,有點(diǎn)慢??筛挠蒙厦骀溄永镏v的建臨時(shí)表的方式。
select count(*), id from test? group by id having count(id) > 1
詳見
http://www.cnblogs.com/shw0315/articles/305959.html
例子:登錄日志表里有128794條記錄,執(zhí)行以下sql
?delete from test a where a.rowid !=
?( select max(b.rowid) from test b where a.id = b.id? )
共刪掉3471條,用時(shí)12617秒,有點(diǎn)慢??筛挠蒙厦骀溄永镏v的建臨時(shí)表的方式。