网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的范文:

 

标题 高效快速删除Oracle表中重复记录
范文
    以前的一篇删除重复记录的虽然还不错 但是在我遇到重量级的大表时还是显的力不从心,不小心想到一种新的方法
    思路1、保存不重复的记录
    2、保存重复记录中的一个rowid
    //3、删除原表中rowid不为步骤2中rowid的记录 ,留下重复数据中的一条
    3.找出记录中rowid为步骤2中rowid的记录
    4 、1和3数据连接就是所要的数据了
    具体操作例子
    第一步:www.examw.com
    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)。
随便看

 

在线学习网范文大全提供好词好句、学习总结、工作总结、演讲稿等写作素材及范文模板,是学习及工作的有利工具。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/20 0:26:30