Created
February 1, 2012 22:37
-
-
Save chrisdavies/1719912 to your computer and use it in GitHub Desktop.
Count the number of silver, gold, platinum, and unique recipients of awards in the Sparcet system.
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
Select | |
FromUserId, | |
Count(case when AwardType = 0 then 1 end) as silver, | |
Count(case when AwardType = 1 then 1 end) as gold, | |
Count(case when AwardType = 2 then 1 end) as plat, | |
Count(distinct ToUserId) as [unique], | |
Count(*) as total | |
From | |
Awards | |
Group By FromUserId; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment