|
删除ORACLE重复的数据常用方式,根据rowid来编写SQL脚本:
delete from t_web
where rowid in (select a.rowid, a.web_name
from t_web a, t_web b
where a.rowid > b.rowid
and a.web_name = b.web_name);
delete from t_web a
where rowid not in
(select max(b.rowid) from t_web b where a.web_name = b.web_name )
delete from t_web
where rowid not in (select max(rowid) from t_web a group by a.web_name);
delete from tbl
where (col1, col2) in
(select col1, col2 from tblgroup bycol1, col2havingcount(*) > 1)
and rowidnotin(selectnin(rowid) fromtblgroup bycol1,
col2havingcount(*) > 1); |
|