Compare Gold, Silver and Bronze Tag Badges

2

Please login or register to vote for this query.

(click on this box to dismiss)

Audio-Video Production Meta

Q&A about the site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation

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

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

-- Delete from here
/*
union all
*#/
Select Top 10 2 As [Order], 'Silver' As Label, UserId As [User Link], Count(*) As Num
From (Select UserId From UserBadges
Where NumBadges>=2) d
Group By UserId
/*
-- or here
union all
*#/
Select Top 10 3 As [Order],*#/ 'Bronze' As Label, UserId As [User Link], Count(*) As Num
From (Select UserId From UserBadges
Where NumBadges>=1) d
Group By UserId
*/
-- To here and it displays the correct number of Gold badges!
Order By [Order], Num Desc

Enter Parameters

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