Posts per Users distribution

0

Please login or register to vote for this query.

(click on this box to dismiss)

Bicycles

Q&A for people who build and repair bicycles, people who train cycling, or commute on bicycles

WITH a AS (

SELECT 
u.id AS user_id
, COUNT(DISTINCT p.id) AS posts
FROM Users u
LEFT JOIN Posts p ON p.OwnerUserId = u.id AND p.PostTypeId = 2 AND (p.CreationDate>'2023-01-01')
GROUP BY u.id
) 
, total AS (
SELECT COUNT(DISTINCT u.id) AS users
FROM Users u
)
SELECT 
COUNT(DISTINCT user_id) AS users

, (SELECT users FROM total) AS total_users
, CONVERT(decimal(4,2), COUNT(DISTINCT user_id) / (SELECT users FROM total) ) AS test
, posts


FROM a
GROUP BY posts

Enter Parameters

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