• 爱情文章
  • 亲情文章
  • 友情文章
  • 生活随笔
  • 校园文章
  • 经典文章
  • 人生哲理
  • 励志文章
  • 搞笑文章
  • 心情日记
  • 英语文章
  • 范文大全
  • 作文大全
  • 新闻阅读
  • 当前位置: 山茶花美文网 > 亲情文章 > 正文

    【高效快速删除Oracle表中重复记录】 删除订单编号重复的记录

    时间:2020-05-28来源:山茶花美文网 本文已影响 山茶花美文网手机站

    以前的一篇删除重复记录的虽然还不错 但是在我遇到重量级的大表时还是显的力不从心,不小心想到一种新的方法

    思路1、保存不重复的记录

    2、保存重复记录中的一个rowid

    //3、删除原表中rowid不为步骤2中rowid的记录 ,留下重复数据中的一条

    3.找出记录中rowid为步骤2中rowid的记录

    4 、1和3数据连接就是所要的数据了

    具体操作例子

    第一步:

    SQL> create table xxfgs_sig as (select imeid imeid,max(dn) dn,max(xlh) xlh,max(pro_name) pro_name,max(area_name) area_na

    me,max(brand) brand,max(m_type) m_type from xxfgs group by imeid having count(*)<2);

    第二步:

    SQL> create table xxfgs_row as (select max(rowid) rowdata,imeid from xxfgs group by imeid having count(*)>1);

    //第三步:////可以考虑给meid建索引

    //SQL>delete from xxfgs where rowid not in (select rowdata from xxfgs_row);

    //或者

    //SQL>delete from xxfgs a where a.rowid <>(select rowdata from xxgs_row b where a.meid=b.meid)。

    • 【高效快速删除Oracle表中重复记录】 删除订单编号重复的记录 相关文章:
    • 爱情文章
    • 亲情文章
    • 友情文章
    • 随笔
    • 哲理
    • 励志
    • 范文大全