answered/unanswered year over year

1

Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

WITH ratio 
AS(
  SELECT
    DATEADD(YEAR, DATEDIFF(YEAR, 0, CreationDate), 0) AS AI, 
    COUNT(DISTINCT Posts.Id) AS Count,
    SUM(CASE WHEN Posts.AnswerCount > 0 THEN 1 ELSE 0 END) AS answered
  FROM Posts
  WHERE PostTypeId = 1 AND CreationDate > '2012-01-01'
  GROUP BY DATEADD(YEAR, DATEDIFF(YEAR, 0, CreationDate), 0)
)
SELECT 
  AI as 'Year',
  Count as 'Total Questions',
  answered*100 / Count as '% Answered'
From ratio
Order by Year DESC

Enter Parameters

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