Most Badges

1

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 TOP 250
  rank() OVER (ORDER BY count(*) DESC) AS [Rank],
  u.DisplayName AS [Display Name], 
  count(*) AS [All Badges],
  count(CASE Class WHEN 1 THEN 1 END) AS [Gold Badges],
  count(CASE Class WHEN 2 THEN 1 END) AS [Silver Badges],
  count(CASE Class WHEN 3 THEN 1 END) AS [Bronze Badges]
FROM Badges AS b
JOIN Users AS u ON u.Id = b.UserId
GROUP BY u.Id, u.DisplayName
ORDER BY count(*) DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results