Answer score distribution

2

Please login or register to vote for this query.

(click on this box to dismiss)

This query will show the distribution of answer scores for a particular user (number of answers for each score and the percentage of the total answer count).

Physics

Q&A for active researchers, academics and students of physics

(
  SELECT
    'any' AS Type,
    Score,
    Count(*) AS Count,
    Str(Count(*) * 100.0 / Sum(Count(*)) OVER(), 10, 1) + '%' AS Percentage
  FROM
    Posts
  WHERE
    OwnerUserId = ##UserId## AND PostTypeId = 2
  GROUP BY
    Score
)
UNION
(
  SELECT
    'accepted' AS Type,
    p1.Score As Score,
    Count(*) AS Count,
    Str(Count(*) * 100.0 / Sum(Count(*)) OVER(), 10, 1) + '%' AS Percentage
  FROM
    Posts AS p1 INNER JOIN Posts AS p2 ON p1.Id = p2.AcceptedAnswerId
  WHERE
    p1.OwnerUserId = ##UserId## AND p1.PostTypeId = 2
  GROUP BY
    p1.Score
)
ORDER BY
  Type, Score

Enter Parameters

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