Users ranked by badge per day

0

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

-- Users ranked by badge per day

DECLARE @endDate date
SELECT @endDate = max(CreationDate) from Posts

SELECT TOP 100
  *, CONVERT(float, NumBadges)/Days as [BadgePerDay]
FROM (
  SELECT
    Users.Id as [User Link],
    COUNT(*) as [NumBadges],
    MAX(DateDiff(Day, Users.CreationDate, @endDate)) as [Days]
  FROM
    Users INNER JOIN Badges
    ON Users.Id = Badges.UserId
  GROUP BY
    Users.Id
) as UsersWithBadgeCount
WHERE
  NumBadges > 15
ORDER BY
  BadgePerDay DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results