Users with highest reputation-to-number-of-posts ratio

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 with highest reputation-to-number-of-answers ratio
-- Does not count self-answers. 
-- Shows users with at least @MinAnswers answers.

DECLARE @MinAnswers int = ##MinAnswers##

SELECT TOP 200
  u.Id AS [User Link],
  count(*) AS NumAnswers,
  u.Reputation AS Reputation,
  CAST(Reputation*1.0/count(*) AS DECIMAL(5,2)) AS ratio
FROM Posts a
INNER JOIN Users u ON u.Id = a.OwnerUserId
INNER JOIN Posts q ON a.ParentId = q.Id
WHERE 
  (q.OwnerUserId <> u.Id OR q.OwnerUserId IS NULL)   --no self answers
  AND a.PostTypeId = 2 -- answer
GROUP BY u.Reputation, u.Id, u.DisplayName
HAVING count(*) >= @MinAnswers
ORDER BY ratio DESC, NumAnswers DESC

Enter Parameters

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