Skip to main content

Posts

Showing posts from February, 2021

Delete duplicate records from the table SQL

 WITH cte AS (        SELECT [ITEMID]       ,[PURCHPRICE]       ,[RETAILAMDISCOUNTTYPE]       ,[CURRENCYCODE]       ,[PURCHDISCPERCENT]       ,[SALESPRICE]       ,[VENDACCOUNT]       ,[FROMDATE]       ,[TODATE]       ,[RETAILPRICECHANGESTATUS]       ,[GROUPID] ,        row_number() OVER(PARTITION BY [ITEMID]       ,[PURCHPRICE]       ,[RETAILAMDISCOUNTTYPE]       ,[CURRENCYCODE]       ,[PURCHDISCPERCENT]       ,[SALESPRICE]       ,[VENDACCOUNT]       ,[FROMDATE]       ,[TODATE]       ,[RETAILPRICECHANGESTATUS]       ,[GROUPID]  order by [ITEMID] ) AS [rn]        FROM [ RETAILPRICECHANGETABLE ]   ...