Skip to content

Instantly share code, notes, and snippets.

@marifrahman
Created July 18, 2013 03:08
Show Gist options
  • Save marifrahman/6026422 to your computer and use it in GitHub Desktop.
Save marifrahman/6026422 to your computer and use it in GitHub Desktop.
Get duplicate record in a column for each group
use *DATABASE_NAME*
go
SELECT *YOUR_FIELD*, COUNT(*) AS dupes
FROM *YOUR_TABLE_NAME*
GROUP BY *YOUR_FIELD*
HAVING (COUNT(*) > 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment