Q&A for professional and enthusiast programmers
SELECT CAST( cast(DATEPART(YYYY, CreationDate) as varchar) + '-' + cast(DATEPART(MM, CreationDate) as varchar) + '-01' as date) Month, Tags.TagName, cast(COUNT(*) as decimal) AS Upvotes -- AVG(Score) AS Scores FROM Tags LEFT JOIN PostTags ON PostTags.TagId = Tags.Id --LEFT JOIN Posts ON Posts.Id = PostTags.PostId LEFT JOIN Votes ON Votes.PostId = PostTags.PostId --LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Tags.TagName IN ('highcharts','chart.js') --AND AND Votes.CreationDate is not null --PostTypes.Name = 'Question' -- Exclude the current month --Posts.CreationDate < DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0) GROUP BY Year(Votes.CreationDate), Month(Votes.CreationDate), Tags.TagName ORDER BY Year(Votes.CreationDate), Month(Votes.CreationDate), Tags.TagName