Users with highest accept rate of their answers

39

Please login or register to vote for this query.

(click on this box to dismiss)

Does not count self-answers. Shows users with at least @MinAnswers answers.

EOS.IO Meta

Q&A about the site for users and developers of distributed applications built on top of the blockchain operating system, EOS.IO

-- Users with highest accept rate of their answers
-- Does not count self-answers. 
-- Shows users with at least @MinAnswers answers.

DECLARE @MinAnswers int = ##MinAnswers##


SELECT TOP 100
  u.Id AS [User Link],
  count(*) AS NumAnswers,
  sum(case when q.AcceptedAnswerId = a.Id then 1 else 0 end) AS NumAccepted,
  (sum(case when q.AcceptedAnswerId = a.Id then 1 else 0 end)*100.0/count(*)) AS AcceptedPercent
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
GROUP BY u.Id
HAVING count(*) >= @MinAnswers
ORDER BY AcceptedPercent DESC, NumAnswers DESC

Enter Parameters

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