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)