Vote histogram on old posts

1

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 
  Votes.CreationDate,
  SUM(CASE WHEN Posts.PostTypeId = 2 THEN 10 ELSE 5 END) AS 'Score'
FROM Votes
JOIN Posts on Posts.Id = Votes.PostId
WHERE Posts.OwnerUserId = ##UserId##
  AND Votes.VoteTypeId IN (1,2) -- Up & down votes
  AND DATEADD(day, ##AgeDifference?30##, Posts.CreationDate) < Votes.CreationDate
GROUP BY Votes.CreationDate
ORDER BY Votes.CreationDate DESC

Enter Parameters

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