WITH BadgeData AS ( SELECT Users.Id AS UserId, Users.Disp...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

WITH BadgeData AS (
SELECT 
  Users.Id AS UserId,
  Users.DisplayName,
  COUNT(*) AS BadgeCount
FROM Badges
JOIN Users
  ON Users.Id = Badges.UserId
JOIN Tags
  ON Tags.TagName = Badges.Name
WHERE Badges.TagBased = 1
AND Badges.Class = 1
GROUP BY Users.Id, Users.DisplayName)

SELECT
  SUM(BadgeCount) AS TotalGoldTagBadges,
  COUNT(UserId) AS UsersWithGoldTagBadge
FROM BadgeData

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results