Skip to content

Instantly share code, notes, and snippets.

@i-e-b
Created March 15, 2012 11:11
Show Gist options
  • Save i-e-b/2043696 to your computer and use it in GitHub Desktop.
Save i-e-b/2043696 to your computer and use it in GitHub Desktop.
TSQL count and value for grouped GUIDs
SELECT
CAST(MIN(CAST(myGuid AS BINARY(16))) AS UNIQUEIDENTIFIER) AS [TheGuid],
COUNT(myGuid) AS [ItsCount]
FROM MyTable
GROUP BY myGuid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment