Q&A for professional and enthusiast programmers
/* SELECT * FROM Tags AS t WHERE t.TagName = N'sql-server-2008'; TagId == 30408 */ DECLARE @sqlServer2008TagId int = 30408; /* SELECT * FROM TagSynonyms AS t WHERE N'sql-server-2008' IN ( t.SourceTagName, t.TargetTagName ); Id: 768 'sql2008' 2020 'mssql2008' 5155 'ssms-2008' */ SELECT YEAR( p.CreationDate ) AS PostedYear, COUNT(*) AS CountPosts, COUNT( p.ClosedDate ) AS CountClosed FROM PostTags AS pt INNER JOIN Posts AS p ON pt.PostId = p.Id WHERE pt.TagId = @sqlServer2008TagId GROUP BY YEAR( p.CreationDate ) ORDER BY PostedYear;