Thursday, 20 April 2017

Duplicate Rows Deletion

Simple Query to Delete the Duplicate Rows Using CTE Table:

WITH CTE AS (SELECT *,ROW_NUMBER() OVER(PARTITION BY unique_column ORDER BY col2) as 'RankNo'
             FROM Table)
DELETE FROM CTE
WHERE RankNo > 1


Et Voila
Pushparaj

No comments: