Q&A about the site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry
SELECT u.Id, u.DisplayName, COUNT(DISTINCT b.Name) AS DistinctBadges, COUNT(b.Id) AS TotalBadges FROM Badges b JOIN Users u ON u.Id = b.UserId GROUP BY u.Id, u.DisplayName ORDER BY DistinctBadges DESC