zoukankan      html  css  js  c++  java
  • Oracle删除重复记录的几种常用方法

    方法1: 

       DELETE FROM   tms_temp_trailer_item tmp

                WHERE   ROWID =

                           (SELECT   ROWID

                              FROM   (SELECT   ROWID,

                                               ROW_NUMBER ()

                                                  OVER (

                                                     PARTITION BY stop_id, po_id

                                                     ORDER BY stop_id, po_id

                                                  )

                                                  rn

                                        FROM   tms_temp_trailer_item) tmp2

                             WHERE   tmp.ROWID = tmp2.ROWID AND tmp2.rn > 1);

     

    方法2:

     DELETE FROM   tms_temp_trailer_item tmp

                WHERE   NOT EXISTS

                           (SELECT   NULL

                              FROM   ( SELECT   stop_id,

                                                 po_id,

                                                 MIN (ROWID) min_row_id

                                          FROM   tms_temp_trailer_item

                                         WHERE   row_type = 'FASTRACK'

                                     GROUP BY   stop_id, po_id) tmp2

                             WHERE   tmp.ROWID = tmp2.min_row_id)

                        AND tmp.row_type = 'FASTRACK';

    魔兽就是毒瘤,大家千万不要玩。
  • 相关阅读:
    Windows程序员的Linux快捷键
    Handeler的详细解释
    Asp.Net_Mvc_View
    使用脚本方式和使用控件方式来输出Html内容的区别
    当发布时报错: 找不到 obj\Debug\Package\PackageTmp\xxx.aspx 文件
    网路岗v1.2简单使用
    Html.Encode
    Android开发中的错误
    Asp.Net_Mvc_IgnoreRoute
    Linux目录结构
  • 原文地址:https://www.cnblogs.com/tracy/p/1712466.html
Copyright © 2011-2022 走看看