Get Percentage of Accepted Answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
(CAST(Count(n.Id) AS float) / (SELECT Count(*) FROM Posts o WHERE PostTypeId = 2) * 100) AS AcceptedPercentage 
FROM 
Posts n
  INNER JOIN
Posts o ON n.Id = o.AcceptedAnswerId
WHERE n.PostTypeId = 2;

Enter Parameters

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