Upvote/Downvote ratio over time

0

Please login or register to vote for this query.

(click on this box to dismiss)

Quantum Computing

Q&A for engineers, scientists, programmers, and computing professionals interested in quantum computing

SELECT
  DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0),
  /*COUNT(CASE VoteTypeId WHEN 2 THEN 1 ELSE NULL END) AS UpVotes,*/
  /*COUNT(CASE VoteTypeId WHEN 3 THEN 1 ELSE NULL END) AS DownVotes,*/
  (
    CAST(COUNT(CASE VoteTypeId WHEN 2 THEN 1 ELSE NULL END) AS FLOAT) /
    CAST(COUNT(CASE VoteTypeId WHEN 3 THEN 1 ELSE NULL END) AS FLOAT)
  ) AS UpDownRatio
FROM Votes
WHERE CreationDate > '2009-01-01'
GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0)
ORDER BY DATEADD(MONTH, DATEDIFF(MONTH, 0, CreationDate), 0);

Enter Parameters

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