Skip to content

Instantly share code, notes, and snippets.

@osmyn
Created February 16, 2017 20:26
Show Gist options
  • Save osmyn/5675d5f13020b316cb0087b4b31990f2 to your computer and use it in GitHub Desktop.
Save osmyn/5675d5f13020b316cb0087b4b31990f2 to your computer and use it in GitHub Desktop.
WITH cte AS
(SELECT *, ROW_NUMBER() OVER (PARTITION BY col1, col2, col3, col4 ORDER BY (SELECT 0)) AS DuplicateRowNumber
FROM table
)
--SELECT * FROM cte WHERE DuplicateRowNumber > 1
DELETE FROM cte WHERE DuplicateRowNumber > 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment