`
izuoyan
  • 浏览: 8943201 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

oracle 中删除重复数据

阅读更多

//删除重复数据

delete

from MT_PL_MATERIALCONFIG

where mt_pl_materialconfig_id in

(select mt_pl_materialconfig_id

from (select max(a.mt_pl_materialconfig_id) as mt_pl_materialconfig_id,

a.ys_materialid,

a.leafblendno

from MT_PL_MATERIALCONFIG a

join (select g.ys_materialid, g.leafblendno

from MT_PL_MATERIALCONFIG g

group by g.ys_materialid, g.leafblendno

having count(*) > 1) b on a.ys_materialid =

b.YS_MATERIALID

and a.leafblendno =

b.leafblendno

group by a.ys_materialid, a.leafblendno) x)

依据分组条件来删除

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics