监控安装 ERP

系统集成论坛

 找回密码
 注册通行证

QQ登录

只需一步,快速开始

路由器交换机防火墙系统集成商城 优质产品采购平台
查看: 1887|回复: 0
打印 上一主题 下一主题

oracle删除重复数据方法

[复制链接]
跳转到指定楼层
1
发表于 2012-5-23 12:09:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
华为金牌代理
删除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);
您需要登录后才可以回帖 登录 | 注册通行证

本版积分规则

联系我们| 手机版|系统集成论坛 ( 京ICP备11008917号 )

GMT+8, 2024-9-30 16:16 , Processed in 0.104271 second(s), 24 queries .

系统集成论坛

BBS.XTJC.COM

快速回复 返回顶部 返回列表