Number of votes per month

10

Please login or register to vote for this query.

(click on this box to dismiss)

Accounting only for votes cast on questions less than 31 days after the question was created.

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

WITH QuestStatsByMonth  AS (
    SELECT DATEADD (month, DATEDIFF (month, 0, q.CreationDate), 0)  AS [Month],
    SUM (q.Score) AS TotalScore,
    COUNT (q.Id) AS NumQuestions,
    COUNT (v.Id) AS Votes

    FROM Posts q
    JOIN Votes v ON q.Id = v.PostId AND (v.VoteTypeId=2 OR v.VoteTypeId=3)
    WHERE q.PostTypeId = 1

    GROUP BY DATEADD (month, DATEDIFF (month, 0, q.CreationDate), 0)
)

SELECT
    q.[Month], 
    q.Votes AS 'votes'

FROM QuestStatsByMonth q
ORDER BY q.[Month]

Enter Parameters

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