Distribution of scores on my answers

18

Please login or register to vote for this query.

(click on this box to dismiss)

Shows how often a user's answers get a specific score. Related to http://odata.stackexchange.com/stackoverflow/q/1930

Biblical Hermeneutics Meta

Q&A about the site for professors, theologians, and those interested in exegetical analysis of biblical texts

-- Distribution of scores on my answers
-- Shows how often a user's answers get a specific score. Related to http://odata.stackexchange.com/stackoverflow/q/1930

DECLARE @totalAnswers DECIMAL
SELECT @totalAnswers = COUNT(*) FROM posts WHERE posttypeid = 2 AND owneruserid = ##UserId##

SELECT score AS AnswerScore, Occurences,
  CASE WHEN Frequency < 1 THEN '<1%' ELSE Cast(Cast(ROUND(Frequency, 0) AS INT) AS VARCHAR) + '%' END AS Frequency
FROM (
  SELECT score, COUNT(*) AS Occurences, (COUNT(*) / @totalAnswers) * 100 AS Frequency
  FROM posts
  WHERE posttypeid = 2                 -- answers
    AND owneruserid = ##UserId##       -- by you
  GROUP BY score
) AS answers
ORDER BY answers.Frequency DESC, Score

Enter Parameters

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