Q&A for anime and manga fans
DECLARE @StartDate DATE = '2009-01-01'; DECLARE @EndDate DATE = '2023-12-31'; WITH TaggedQuestions AS ( SELECT Id, CreationDate, CASE WHEN CHARINDEX('<thymeleaf>', Tags) > 0 THEN 1 ELSE 0 END AS ThymeleafTag, CASE WHEN CHARINDEX('<jsf>', Tags) > 0 THEN 1 ELSE 0 END AS JSFTag, CASE WHEN CHARINDEX('<vaadin>', Tags) > 0 THEN 1 ELSE 0 END AS VaadinTag FROM PostsWithDeleted WHERE PostTypeId = 1 AND CreationDate >= @StartDate AND CreationDate <= @EndDate ), MonthlyCounts AS ( SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS Month, SUM(ThymeleafTag) AS Thymeleaf, SUM(JSFTag) AS JSF, SUM(VaadinTag) AS Vaadin FROM TaggedQuestions GROUP BY DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) ) SELECT Month, Thymeleaf, JSF, Vaadin FROM MonthlyCounts ORDER BY Month;