2D users reputation/scores (distribution for total score)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Apps

Q&A for apps, scripts, and development with the Stack Exchange API

WITH a AS (
   SELECT 
       OwnerUserId,
       CASE
          WHEN VoteTypeId = 2
             THEN 1
             ELSE 0
       END Upvote,
       CASE
          WHEN VoteTypeId = 3
             THEN 1
             ELSE 0
       END Downvote,
       CASE
          WHEN PostTypeId = 1
             THEN 1
             ELSE 0
       END Questionvote,
       CASE
          WHEN PostTypeId = 2
             THEN 1
             ELSE 0
       END Answervote
   FROM Posts p INNER JOIN Votes v ON v.PostId = p.Id
), 
b AS (
Select top 20000 (sum((Upvote-Downvote))) as TotalScore,
                 (sum(Answervote*(Upvote-Downvote))) as AnswerScore,
                 OwnerUserId,
                 (sum(Questionvote*(Upvote-Downvote))) as QuestionScore 
from a 
Group By OwnerUserId
Order By sum(Answervote*(Upvote-Downvote)) desc
)


Select COUNT(QuestionScore/AnswerScore)
from b
Where TotalScore < 100 AND AnswerScore>0
Group By OwnerUserId

Enter Parameters

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