Number of upvotes per month in one year

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0), COUNT(*)
  FROM Votes
  WHERE VoteTypeId = 2 -- upvotes
    AND CreationDate >= '2016-01-01'
    AND CreationDate <= '2016-12-31'
  GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0)
  ORDER BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0)

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results