Count of users by posts

1

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

WITH Raw AS (
  SELECT PostTypeId, OwnerUserId AS UserId, COUNT(*) AS PostCount
  FROM Posts
  WHERE PostTypeId <= 2
  GROUP BY PostTypeId, OwnerUserId
),
Raw2 AS (
  SELECT PostTypeId, PostCount, COUNT(*) AS UserCount
  FROM Raw
  GROUP BY PostTypeId, PostCount
)
SELECT Raw2.PostCount, PostTypes.Name, Raw2.UserCount
FROM Raw2, PostTypes
WHERE
  Raw2.PostTypeId = PostTypes.Id
  AND
  Raw2.PostCount < ##MaxPostCount:int?30##
ORDER BY Raw2.PostCount, Raw2.PostTypeId;

Enter Parameters

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