Q&A for Drupal developers and administrators
SELECT 'All Activity' as name, CONCAT(YEAR(Votes.CreationDate), '-', RIGHT('0' + CONVERT(varchar(10), MONTH(Votes.CreationDate)), 2) , '-01') as date, COUNT(DISTINCT(Votes.id)) as vote_count , Count(DISTINCT(Posts.id)) as post_count, COUNT(DISTINCT(Posts.OwnerUserId)) as user_count FROM Posts LEFT JOIN Votes on Votes.PostId = Posts.Id LEFT JOIN PostTags on PostTags.PostId = Posts.Id WHERE Votes.CreationDate IS NOT NULL GROUP BY YEAR(Votes.CreationDate), MONTH(Votes.CreationDate) ORDER BY YEAR(Votes.CreationDate), MONTH(Votes.CreationDate)