100% accept rate

0

Please login or register to vote for this query.

(click on this box to dismiss)

Find users with the best accept rates, ordered by total number of answers. Self-answers and users with less than 6 answers are excluded from the calculation.

Stack Overflow

Q&A for professional and enthusiast programmers

-- 100% accept rate
-- Find users with the best accept rates, ordered by total number of answers. Self-answers and users with less than 6 answers are excluded from the calculation.

SELECT 
    t.OwnerUserId AS [User Link],
    t.Total,
    Round(t.Accepted * 100.0 / t.Total, 1) AS [Percent]
  FROM
    (SELECT
         a.OwnerUserId,
         Count(a.Id) AS [Total],
         Sum(CASE q.AcceptedAnswerId WHEN a.Id THEN 1 ELSE 0 END) AS [Accepted]
       FROM Posts AS a
         JOIN Posts AS q
           ON a.ParentId = q.Id
       WHERE q.postTypeId = 1 AND a.postTypeId = 2 AND a.OwnerUserId <> q.OwnerUserId
       GROUP BY a.OwnerUserId
   ) AS t 
WHERE t.[Total] >= 6 AND t.[Accepted] = t.[Total]
ORDER BY t.[Total] DESC

Enter Parameters

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