WEB开发网
开发学院数据库Oracle Oracle 删除重复记录的方法 阅读

Oracle 删除重复记录的方法

 2007-05-13 12:31:55 来源:WEB开发网   
核心提示:使用分析函数rownumber() over( partition by ... order by ...)下面是一个例子。DELETE FROM Portfolio_Prod_Summ_Ytd_MvWHERE ROWID IN (SELECT Rowind FROM (SELECT ROWID Rowind, Row

使用分析函数rownumber() over( partition by ... order by ...)

下面是一个例子。

  DELETE FROM Portfolio_Prod_Summ_Ytd_Mv
WHERE ROWID IN (SELECT Rowind
      FROM (SELECT ROWID Rowind,
         Row_Number() Over(PARTITION BY Gmis_Prod_Code_Ref, Service_Type_Ref, Booking_Center, Client_Advisor_Gpn, As_On_Date, Client_Asst_Chf, Liabilities_Chf, Revenue_Chf, Ytd_Revenue_Chf, Client_Asst_Usd, Liabilities_Usd, Revenue_Usd, Ytd_Revenue_Usd, Client_Asst_Booking_Center, Liabilities_Booking_Center, Revenue_Booking_Center, Ytd_Revenue_Booking_Center, Dmm_Csk_Id, Ca_Name, Desk_Name, Desk_Fis_Id, Ct_Name, Ct_Fis_Id, Bs_Name, Bs_Fis_Id, Service_Type_Ref_Org, Product_Code_Type_Ref, Aum_Usd, Aum_Booking_Center, Aum_Chf, Hri_Gpn, Desk_Cccode, Ct_Cccode, Bs_Cccode, Bu_Cccode, Bu_Name, Ba_Cccode, Ba_Name ORDER BY Gmis_Prod_Code_Ref) Rownumber
        FROM Portfolio_Prod_Summ_Ytd_Mv)
     WHERE Rownumber > 1)

Tags:Oracle 删除 重复

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接