Total Daily Votes By User (last 30 days)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Query total downvotes, or upvotes, on all posts for the last 30 days by owner and day.

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT    PostOwner.Id AS 'PostOwnerId',
          PostOwner.DisplayName AS 'PostOwnerDisplayName',
          Posts.Id,
          CAST(Votes.CreationDate AS date) AS 'Date',
          COUNT(*) AS 'TotalDailyVotes'
FROM      Votes
LEFT JOIN Posts
ON        Votes.PostId = Posts.Id
LEFT JOIN Users AS PostOwner
ON        Posts.OwnerUserId = PostOwner.Id
WHERE     DATEDIFF(day, Votes.CreationDate, getdate()) < 31
      AND Votes.VoteTypeId = 3 -- downvotes
--      AND  Votes.VoteTypeId = 2 -- upvotes
      AND DATEDIFF(day, Votes.CreationDate, getdate()) < 31
      AND NOT PostOwner.Id IS NULL
--      AND PostOwner.Id = @MyUserId
GROUP BY
          PostOwner.Id,
          PostOwner.DisplayName,
          CAST(Votes.CreationDate AS date),
          Posts.Id
HAVING    COUNT(*) > 3
ORDER BY  CAST(Votes.CreationDate AS date) DESC,
          COUNT(*) DESC

Enter Parameters

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