SELECT UserId as [User Link], AVG(CAST(CommentCount as fl...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
  UserId as [User Link],
  AVG(CAST(CommentCount as float)) as [Average Comments/Post],
  Count(*) as [Posts]
FROM (
  SELECT
    UserId,
    COUNT(*) as CommentCount
  FROM
    Comments
  GROUP BY
    UserId,
    PostId
) as CommentCounts
GROUP BY UserId
ORDER BY
  [Average Comments/Post] DESC

Enter Parameters

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