Q&A for professional and enthusiast programmers
-- http://meta.stackexchange.com/questions/148147/can-we-expose-class-for-badges-in-data-explorer WITH TagBadges AS ( SELECT u.Id AS [UserId], Max(u.Reputation) AS [Reputation], b.Name AS [Name], Count(*) AS [Level] FROM Users u INNER JOIN Badges b ON u.Id = b.UserId WHERE ASCII(LEFT(b.Name, 1)) BETWEEN 97 AND 122 GROUP BY b.Name, u.Id ) SELECT UserId AS [User Link], Max(Reputation) AS [Rep], Count(*) AS [Count] FROM TagBadges tb WHERE tb.Level = 2 GROUP BY UserId ORDER BY Max(Reputation) DESC, UserId DESC