删除重复数据

来源:互联网 发布:成志网络 编辑:程序博客网 时间:2024/06/05 18:36
--消耗很少
delete from t_dfn_monthdel
 where (fshippernumberid,fmonth) in (select fshippernumberid,fmonth
                   from t_dfn_monthdel
                  group by fshippernumberid,fmonth
                 having count(*) > 1)
     and rowid not in
         (select min(rowid) from t_dfn_monthdel group by fshippernumberid,fmonth having count(*) > 1);
--消耗巨大,不建议使用
delete from deppon009.t_dfn_monthdel mo where rowid >
(select min(mo1.rowid) from deppon009.t_dfn_monthdel mo1
where mo1.fshippernumberid = mo.fshippernumberid
and mo1.fmonth = mo.fmonth
 having count(*) > 1
);
0 0
原创粉丝点击