Question, answer, vote and comment volume per month

0

Please login or register to vote for this query.

(click on this box to dismiss)

MathOverflow

Q&A for professional mathematicians

SELECT
  DATEADD(mm, (Year(Posts.CreationDate) - 1900) * 12 + Month(Posts.CreationDate) - 1, 0) AS Month,
  PostTypes.Name as Type,
  COUNT(*) AS Count,
  SUM(Posts.Score) AS Score,
  SUM(Posts.FavoriteCount) as CommentCount,
  SUM(Posts.ViewCount) as ViewCount,
  SUM(LEN(Posts.Title)) as TitleChars,
  SUM(LEN(Posts.Body)) as BodyChars,
  SUM(Posts.CommentCount) as CommentCount
  
FROM Posts
  LEFT JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId

WHERE
  PostTypes.Name IN ('Answer', 'Question') AND
  Posts.CreationDate < DATEADD(month, DATEDIFF(month, 0, GETDATE()), 0)

GROUP BY
  Year(Posts.CreationDate), Month(Posts.CreationDate), PostTypes.Name

ORDER BY
  Year(Posts.CreationDate), Month(Posts.CreationDate), PostTypes.Name

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results