Distribution of users by their question/answer ratio

1

Please login or register to vote for this query.

(click on this box to dismiss)

Moderators

Q&A for community managers, administrators, and moderators

WITH Raw AS (
  SELECT
    OwnerUserId AS UserId,
    COUNT(CASE WHEN PostTypeId = 2 THEN 1 ELSE NULL END) AS Answers,
    COUNT(*) AS Posts
  FROM Posts
  WHERE PostTypeId IN (1,2)
  GROUP BY OwnerUserId
),
Raw2 AS (
  SELECT
    UserId,
    CASE
      WHEN Answers < Posts THEN
        CAST(1.0 * ##Segments:int?10## * Answers / Posts AS INTEGER)
      ELSE
        ##Segments## - 1
    END AS AnswerRatio
  FROM Raw
  WHERE Posts > ##MinPosts:int?10##
)
SELECT
  AnswerRatio,
  COUNT(*) AS Count
FROM Raw2
GROUP BY AnswerRatio
ORDER BY AnswerRatio

Enter Parameters

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