Q&A for those who study, teach, research and apply economics and econometrics
SELECT Year(p.CreationDate) [year], COUNT(p.Id) AS [Total Posts], SUM(case when p.PostTypeId = 1 then 1 else 0 end) AS [Total Questions], SUM(case when p.PostTypeId = 2 then 1 else 0 end) AS [Total Answers] FROM Posts p GROUP BY Year(p.CreationDate) ORDER BY Year(p.CreationDate)