Q&A about the site for administrators and users of the CiviCRM Constituent Relationship Management software
SELECT c.Month, c.Type, c.Count FROM ( SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0) AS [MONTH], COUNT(DISTINCT Posts.Id) AS Count, 'Question count' as Type FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Tags.TagName like 'flutterflow%' AND PostTypeId = 1 AND CreationDate > '2022-01-01' GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0) UNION ALL SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, Answers.CreationDate), 0) AS [MONTH], COUNT(DISTINCT Answers.Id) AS Count, 'Answer count' as Type FROM Posts AS Answers INNER JOIN Posts AS Questions ON Answers.ParentId = Questions.Id INNER JOIN PostTags ON PostTags.PostId = Questions.Id INNER JOIN Tags ON PostTags.TagId = Tags.Id WHERE Tags.TagName like 'flutterflow%' AND Answers.PostTypeId = 2 AND Answers.CreationDate > '2022-01-01' GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, Answers.CreationDate), 0) ) as c ORDER BY [MONTH] DESC