Skip to content

Instantly share code, notes, and snippets.

@mvodep
Last active March 2, 2019 07:56
Show Gist options
  • Save mvodep/6408eea1d2b0387f8f7726c6fba07bd3 to your computer and use it in GitHub Desktop.
Save mvodep/6408eea1d2b0387f8f7726c6fba07bd3 to your computer and use it in GitHub Desktop.
WITH CTE AS(
SELECT [col1], [col2], [col3], [col4], [col5], [col6], [col7],
RN = ROW_NUMBER() OVER(PARTITION BY Col1, Col2, ... ORDER BY OrderColumn)
FROM dbo.Table1
)
DELETE FROM CTE WHERE RN > 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment