Created
March 2, 2017 19:51
-
-
Save aramkoukia/1468c930696ed4199697edeb5b7d1ccb to your computer and use it in GitHub Desktop.
TSQL Deduplicating data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;WITH myCTE (RowNumber, ProductId, ProductName) | |
| AS ( | |
| SELECT ROW_NUMBER() OVER ( | |
| PARTITION BY ProductName ORDER BY ProductName | |
| ) AS RowNumber , | |
| ProductId ,ProductName FROM #Products | |
| ) | |
| SELECT * FROM myCTE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment