Eligible to vote on controversial Docs edit

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select b.name,
    sum(case when b.class=1 then 1 else 0 end) as Gold,
    sum(case when b.class=2 and u.reputation>5000 then 1 else 0 end) as "Silver + 5k",
    sum(case when b.class=3 and u.reputation>10000 then 1 else 0 end) as "Bronze + 10k",
    1 as "Jon Skeet"
from (select UserId, Name, min(class) class from Badges where tagbased='true' group by UserId, Name) b
left join  Users u on u.Id=b.UserId
group by b.name
order by Gold,"Silver + 5k","Bronze + 10k"

Enter Parameters

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