Created
January 3, 2021 14:28
-
-
Save halityurttas/92d0ee471355e11d84ef19c0be2796d4 to your computer and use it in GitHub Desktop.
Remove duplicate sql (for example nop commerce specification attributes)
This file contains 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 duplicates AS ( | |
SELECT | |
*, | |
ROW_NUMBER() OVER ( | |
PARTITION BY SpecificationAttributeId, Name | |
ORDER BY SpecificationAttributeId, Name | |
) RN | |
FROM | |
[nopdb].[dbo].[SpecificationAttributeOption] | |
) | |
DELETE FROM duplicates WHERE RN > 1; | |
--SELECT * FROM duplicates WHERE RN = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment