Compare Gold, Silver and Bronze Tag Badges

1

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

With UserBadges AS (Select UserId, Count(*) As NumBadges From Badges
Where Name In (Select TagName from Tags)
Group By UserId, Name) 

Select 1 As [Order], 'Gold' As Label, UserId As [User Link], Num
From (
Select Top 10 UserId, Count(*) As Num
From (Select UserId From UserBadges
Where NumBadges>=3) d
Group By UserId
Order By Num desc) G

union all

Select 2 As [Order], 'Silver' As Label, UserId As [User Link], Num
From (
Select Top 10 UserId, Count(*) As Num
From (Select UserId From UserBadges
Where NumBadges>=2) d
Group By UserId
Order By Num desc) S

union all

Select 3 As [Order], 'Bronze' As Label, UserId As [User Link], Num
From (
Select Top 10 UserId, Count(*) As Num
From (Select UserId From UserBadges
Where NumBadges>=1) d
Group By UserId
Order By Num desc) B

Order By [Order], Num Desc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results