Reputaiton and Accepted Answer

1

Please login or register to vote for this query.

(click on this box to dismiss)

Programming Language Design and Implementation

Q&A for designers and implementers of computer programming languages

SELECT
    u.Reputation,
    COUNT(CASE WHEN p.Id = q.AcceptedAnswerId THEN 1 END) AS AcceptedAnswers,
    COUNT(*) AS TotalAnswers,
    CAST(COUNT(CASE WHEN p.Id = q.AcceptedAnswerId THEN 1 END) AS FLOAT) / COUNT(*) AS AcceptanceRate
FROM
    Posts p
JOIN
    Users u ON p.OwnerUserId = u.Id
JOIN
    Posts q ON p.ParentId = q.Id
WHERE
    p.PostTypeId = 2 -- 2 for Answers
GROUP BY
    u.Reputation
ORDER BY
    u.Reputation;

Enter Parameters

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