Votes: Most Upvoted Users

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mathematics

Q&A for people studying math at any level and professionals in related fields

SELECT Top ##Top:int?100##
  b.OwnerUserId AS [User Link],
  SUM(CASE WHEN a.VoteTypeId = 2 THEN 1 ELSE 0 END) AS UpVotes,
  MIN(b.CreationDate) AS OldestPost,
  COUNT(DISTINCT b.Id) AS NumberOfPosts,
  Round (1.0 * SUM(CASE WHEN a.VoteTypeId = 2 THEN 1 ELSE 0 END) / COUNT(DISTINCT b.Id), 2) as [AvgUpVotesPerPost]

FROM Votes a
  INNER JOIN Posts b
    ON 
      a.PostId = b.Id
      AND b.PostTypeId IN (1,2) -- Only questions and answers
WHERE 
  a.VoteTypeId IN (2,3) -- Only up and down votes
GROUP BY b.OwnerUserId
--ORDER BY SUM(CASE WHEN a.VoteTypeId = 2 THEN 1 ELSE 0 END) DESC
HAVING count(distinct b.id) > ##PostsGreaterThan:int?200##
ORDER BY [AvgUpVotesPerPost] desc

Enter Parameters

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