Q&A about the site for information security professionals
SELECT Year(p.CreationDate) AS [Year], COUNT(p.Id) AS [Total], SUM(case when (p.PostTypeId=1) then 1 else 0 end) AS [Questions], SUM(case when (p.PostTypeId=2) then 1 else 0 end) AS [Answers] FROM PostsWithDeleted p INNER JOIN Votes v ON v.PostId = p.Id WHERE v.VoteTypeId IN (##types?4,12##) AND p.DeletionDate IS NOT NULL GROUP BY Year(p.CreationDate) ORDER BY Year(p.CreationDate)