What Percentage of Questions have Accepted Answers ?

2

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- This query will tell:
-- 1). how many questions the site has
-- 2). how many of those questions have accepted answers
-- 3). what percentage those questions represent

WITH Total AS
(SELECT TotalCount = COUNT(*)
  FROM Posts
  WHERE PostTypeId=1),
Accep AS
(SELECT AcceptedCount = COUNT(*)
  FROM Posts
  WHERE PostTypeId=1 AND AcceptedAnswerId IS NOT NULL)

SELECT
  TotalCount AS [Total Questions],
  (SELECT AcceptedCount FROM Accep) AS [With Accepted Answer],
  (100*(SELECT AcceptedCount FROM Accep))/TotalCount AS [Percentage Accepted]
FROM Total

Enter Parameters

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