What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

We can see statistics about reputation at http://stackexchange.com/leagues/1/alltime/stackoverflow.

How can I find who had maximum number of badges on Stack Overflow ? It would be nice to see extracted from data center.

I would like to see all maximum statistics of badges:

  • Person having maximum total no. of badges
  • Person having maximum general badges
  • Person having maximum no. of tag badges
  • Person having maximum bronze badges
  • Person having maximum silver badges
  • Person having maximum gold badges
  • Person having maximum general bronze badges
  • Person having maximum general silver badges
  • Person having maximum general gold badges
  • Person having maximum tag bronze badges
  • Person having maximum tag silver badges
  • Person having maximum tag gold badges

Solution to all questions might be Jon Skeet. But I want to a foolproof solution for this

share|improve this question
5  
    
Users by Number of General Gold Badges. There's no way to tell if a badge is gold, so you need to hard-core the list of badges. –  Jeremy Banks May 5 '12 at 20:05

2 Answers 2

up vote 2 down vote accepted

Top Tag Badge Counts

Select Top 10 UserId As [User Link],
    Count(*) As NumTagBadges
From Badges
Where Name In (Select TagName from Tags Where IsNull(TagName,'')<>'')
Group By UserId
Order By NumTagBadges Desc

Top 4:

  1. Jon Skeet - 387
  2. Marc Gravell - 157
  3. Darin Dimitrov - 132
  4. BalusC - 116

Top Gold, Silver and Bronze Tag Badges

SQL too complex

Top 4 Gold:

  1. Jon Skeet - 25
  2. Marc Gravell - 11
  3. Darin Dimitrov - 10
  4. BalusC - 10

Top 4 Silver:

  1. Jon Skeet - 76
  2. Marc Gravell - 29
  3. SLaks - 27
  4. BalusC - 22

Top 4 Bronze:

  1. Jon Skeet - 286
  2. Marc Gravell - 117
  3. Darin Dimitrov - 101
  4. BalusC - 84

Top Non-Tag Badge Counts

Select Top 10 UserId As [User Link],
   Count(*) As NumNonTagBadges
From Badges
Where Name Not In (Select TagName from Tags)
 And IsNull(Name,'')<>''
Group By UserId
Order By NumNonTagBadges Desc

Top 4:

  1. Jon Skeet - 4581
  2. Marc Gravell - 1497
  3. Eric Lippert - 1164
  4. JaredPar - 935
share|improve this answer
    
I have no idea if the removal of Null and '' is needed. –  Mark Hurd Apr 2 '12 at 3:40
    
I have confirmed the Null and '' check was not needed. –  Mark Hurd Apr 2 '12 at 5:21
    
Nice work. Is it possible to get maximum counts with 3 different types also? –  Somnath Muluk Apr 3 '12 at 4:15
    
This (should*) compares Gold, Silver and Bronze Tag Badges, based on the fact that the first one is Bronze, a second is Silver and a third is Gold. The non-Tag badges would need to be manually listed in IN ('','',...) clauses to get them. (*) I assume the data is being updated at the moment, which is why the current results don't make sense. –  Mark Hurd Apr 3 '12 at 13:40
    
I've created Data Explorer Discussions in chat to determine what is actually wrong with the Gold, Silver, Bronze query. –  Mark Hurd May 1 '12 at 15:39
    
Tim Stone rewrote my query without Unions. –  Mark Hurd May 1 '12 at 16:38
    
My Gold, Silver and Bronze Tag Badges query now works as expected. Clearly the Select Top Union Order By does do something different to what is expected. –  Mark Hurd May 2 '12 at 2:29
    
And, in fact, my query correctly includes the Gold badges in Silver and Bronze counts, etc. Changing the answer now... –  Mark Hurd May 2 '12 at 5:45

Thanks The Establishment,

For Maximum number of badges (all kinds)-

SELECT TOP 100
    Users.Id as [User Link], COUNT(*) as [NumBadges]
  FROM
    Users INNER JOIN Badges
    ON Users.Id = Badges.UserId
  GROUP BY
    Users.Id
    ORDER BY
  NumBadges DESC

Top 5 persons for maximum number of badges:

  • Jon Skeet - 4968
  • Marc Gravell - 1654
  • Eric Lippert - 1206
  • JaredPar - 1042
  • Greg Hewgill - 968
share|improve this answer
    
I didn't got any clue for calculating other questions. –  Somnath Muluk Mar 30 '12 at 8:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .