Q&A for people studying math at any level and professionals in related fields
WITH b AS (SELECT UserId, Name FROM Badges WHERE Name IN ('Civic Duty', 'Cleanup', 'Deputy', 'Electorate', 'Marshal', 'Reviewer', 'Sportsmanship', 'Steward') GROUP BY UserId, Name) SELECT UserId AS [User Link], COUNT(*) AS 'Number of moderation badges' FROM b GROUP BY UserId ORDER BY COUNT(*) DESC