Number of Votes per Month

0

Please login or register to vote for this query.

(click on this box to dismiss)

The total number of votes (upvotes and downvotes) per month

Skeptics

Q&A for scientific skepticism

-- Number of Votes per Month
-- The total number of votes (upvotes and downvotes) per month

SELECT     YEAR(v.CreationDate) year, 
           MONTH(v.CreationDate) month, 
           CAST(COUNT(*) AS float) /
           (
              SELECT CAST(COUNT(*) + 1 AS float)
              FROM   users u
              WHERE  u.CreationDate <= CAST(CAST(YEAR(v.CreationDate) AS CHAR(4)) + '-' + CAST(MONTH(v.CreationDate) AS CHAR(2)) + '-01' AS date)
           ) number_of_users
FROM       votes v
GROUP BY   YEAR(v.CreationDate), MONTH(v.CreationDate)
ORDER BY   1 DESC, 2 DESC

Enter Parameters

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