Q&A for gardeners and landscapers
WITH m as ( SELECT DATEADD(mm, (Year(Posts.CreationDate) - 1900) * 12 + Month(Posts.CreationDate) - 1, 0) AS Month, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ( 'tensorflow', 'pytorch', 'keras' ) AND Year(Posts.CreationDate) > 2015 AND PostTypes.Name = 'Question' GROUP BY Year(Posts.CreationDate), Month(Posts.CreationDate), Tags.TagName ), ma as ( SELECT DATEADD(mm, (Year(Posts.CreationDate) - 1900) * 12 + Month(Posts.CreationDate) - 1, 0) AS Month, COUNT(*) AS Questions FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId LEFT JOIN Posts as Answers ON Posts.AcceptedAnswerId = Answers.Id WHERE Tags.TagName IN ( 'tensorflow', 'pytorch', 'keras' ) AND Year(Posts.CreationDate) > 2015 AND PostTypes.Name = 'Question' AND DATEDIFF(DAY, Answers.CreationDate, Posts.CreationDate) < 0 GROUP BY Year(Posts.CreationDate), Month(Posts.CreationDate), Tags.TagName ) SELECT m.Month, sum(m.Questions) as Questions, sum(ma.Questions) as SolvedQuestions FROM m JOIN ma on m.Month=ma.Month GROUP BY m.Month