Created
June 23, 2014 22:22
-
-
Save iainelder/a402fec91b56b59780ab to your computer and use it in GitHub Desktop.
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
# T-SQL doesn't support the INTERSECT ALL operator. | |
# This gets you close. | |
# It only returns just one copy of each duplicate. | |
# GROUP BY * is not valid syntax so you have to write all the column names out. | |
SELECT * | |
FROM ( | |
SELECT * | |
FROM #HasDupes | |
UNION ALL | |
SELECT DISTINCT * | |
FROM #HasDupes | |
) AS allrows | |
GROUP BY <all columns> | |
HAVING COUNT(*) > 2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment