Question Score June 2012, with Vote Creation Date

0

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 SUM(CASE Votes.VoteTypeId WHEN 2 THEN 1 ELSE 0 END)
    - SUM(CASE Votes.VoteTypeId WHEN 3 THEN 1 ELSE 0 END) score,
    Users.DisplayName
   FROM Posts
   INNER JOIN Users ON Users.ID = Posts.OwnerUserId
   INNER JOIN Votes ON Votes.PostId = Posts.Id
   WHERE PostTypeId = 1
   AND Posts.CreationDate BETWEEN '2012-06-01' AND '2012-06-30'
   AND Votes.CreationDate BETWEEN '2012-06-01' AND '2012-06-30'
   GROUP BY Users.DisplayName
   ORDER BY score DESC

Enter Parameters

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