Answer acceptance ratio v2

0

Please login or register to vote for this query.

(click on this box to dismiss)

Display, in descending order, the ratio of accepted answers for users with at least MinRep. This excludes answers to questions that have no accepted answers.

Mythology Meta

Q&A about the site for enthusiasts and scholars of mythology and folklore

-- Answer acceptance ratio v2
-- Display, in descending order, the ratio of accepted answers for users with at least MinRep. This excludes answers to questions that have no accepted answers.

    SELECT DisplayName, Answers, Accepted, 
           Accepted*1.0/Answers as Ratio
      FROM Users 
INNER JOIN

(SELECT x.OwnerUserId, Accepted, Answers
   FROM
(SELECT a.OwnerUserId, COUNT(*) AS Accepted
       FROM Posts a
 INNER JOIN Posts q
         ON q.AcceptedAnswerId = a.Id
   GROUP BY a.OwnerUserId ) x

INNER JOIN

(SELECT a.OwnerUserId, COUNT(*) AS Answers
       FROM Posts a
 INNER JOIN Posts q
         ON a.ParentId = q.Id
      WHERE a.PostTypeId = 2 AND q.AcceptedAnswerId IS NOT NULL
   GROUP BY a.OwnerUserId ) y
ON x.OwnerUserId = y.OwnerUserId
) z
      ON OwnerUserId = Id
   WHERE Reputation > ##MinRep##
ORDER BY Ratio DESC

-- Enter Query Description

Enter Parameters

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