Votes on [Post] Over Time

1

Please login or register to vote for this query.

(click on this box to dismiss)

Total upvotes, downvotes, and all votes on [post] each day over the post's history.

Ask Different

Q&A for power users of Apple hardware and software

SELECT
  DATEFROMPARTS(YEAR(v.CreationDate), MONTH(v.CreationDate), DAY(v.CreationDate)) AS [Date],
  SUM(COUNT(*)) OVER(ORDER BY DATEFROMPARTS(YEAR(v.CreationDate), MONTH(v.CreationDate), DAY(v.CreationDate)) ROWS UNBOUNDED PRECEDING) AS [All votes],
  SUM(COUNT(CASE WHEN v.VoteTypeId = 2 THEN 1 ELSE NULL END)) OVER(ORDER BY DATEFROMPARTS(YEAR(v.CreationDate), MONTH(v.CreationDate), DAY(v.CreationDate)) ROWS UNBOUNDED PRECEDING) AS [Upvotes],
  SUM(COUNT(CASE WHEN v.VoteTypeId = 3 THEN 1 ELSE NULL END)) OVER(ORDER BY DATEFROMPARTS(YEAR(v.CreationDate), MONTH(v.CreationDate), DAY(v.CreationDate)) ROWS UNBOUNDED PRECEDING) AS [Downvotes]
FROM Votes v
WHERE v.PostId = ##PostId:int## AND v.VoteTypeId IN (2, 3)
GROUP BY DATEFROMPARTS(YEAR(v.CreationDate), MONTH(v.CreationDate), DAY(v.CreationDate))
ORDER BY DATEFROMPARTS(YEAR(v.CreationDate), MONTH(v.CreationDate), DAY(v.CreationDate))

-- PostId: PostId of Post

Enter Parameters

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