zoukankan      html  css  js  c++  java
  • 使用oracle删除表中重复记录

     (1)使用用rowid方法

           查询重复数据:select * from person a where rowid !=(select max(rowid) from person b where a.cardid=b.cardid and a.pname=b.pname);

           删除重复数据:delete from person a where rowid !=(select max(rowid) from person b where a.cardid=b.cardid and a.pname=b.pname);

    (2)使用group by方法

         查询重复数据:select * from person where cardid in (select cardid from person group by cardid having count(cardid)>1);

         删除重复数据:delete from person where cardid in (select cardid from person group by cardid having count(cardid)>1) and rowid not in (select min(rowid) from person                                group by cardid having count(cardid)>1);

  • 相关阅读:
    140704
    140703
    140702
    堆排序
    并查集
    140701
    这年暑假集训-140630
    vim for python
    hihocode 第九十二周 数论一·Miller-Rabin质数测试
    hdu 3157 Crazy Circuits 有源汇和下界的最小费用流
  • 原文地址:https://www.cnblogs.com/hongwei2085/p/8850300.html
Copyright © 2011-2022 走看看