Average reputation of users depending on number of posts

1

Please login or register to vote for this query.

(click on this box to dismiss)

Blender Meta

Q&A about the site for people who use Blender to create 3D graphics, animations, or games

---by changing mult you decide how the users are divided into groups
---for example, if mult=10, we're looking at users with 0 to 9 posts, users with 10 to 19 posts, etc.
;with postgroups_cte AS (
SELECT
  u.Id AS uid,
  u.Reputation AS rep,
  CAST(COUNT(p.Id)/##mult?100## AS int) AS pgroup
  FROM Users u INNER JOIN Posts p ON p.OwnerUserId=u.Id
  GROUP BY u.Id, u.Reputation
)

SELECT
  pgroup,
  AVG(CAST(rep AS decimal)) AS Average
FROM postgroups_cte
GROUP BY pgroup
ORDER BY pgroup DESC

Enter Parameters

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