unaccepted answers per year

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 
  YEAR(q.CreationDate) AS year,
  COUNT(CASE WHEN a.AcceptedAnswerId IS NULL THEN 1 END) AS unaccepted_answers_count
FROM 
  Posts q
LEFT JOIN 
  Posts a ON q.Id = a.ParentId
WHERE 
  q.PostTypeId = 1 -- Question
GROUP BY 
  YEAR(q.CreationDate)
order by
  YEAR(q.CreationDate)

Enter Parameters

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