SQL删除重复数据

    delete from [EPLUSv2.0_Back4].[dbo].[T_StorageOrder] where Id in (
  SELECT Id from

    (select ROW_NUMBER() over

               (
                 partition by SaleOrderId
             order by SaleOrderId
               ) RowNumber,* from [EPLUSv2.0_Back4].[dbo].[T_StorageOrder]

      ) a where a.RowNumber > 1 and a.OrderType=1)

 

你可能感兴趣的:(SQL删除重复数据)