Distribution of post frequency by users

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
  -- c.post_count
  --,c.cum_posts
   100*c.cum_users / ( max(c.cum_users) 
                          over ()
                        ) cum_users_pctg
  ,100*c.cum_posts / ( max(c.cum_posts) 
                          over () 
                        ) cum_posts_pctg
  --,c.cum_users

from(
  select
    b.post_count
   ,1.0*sum(b.post_count) over (order by b.post_count desc) 
      as cum_posts
   ,1.0*sum(b.users_having_post_count) over (order by b.post_count desc) 
      as cum_users
  from (
    select 
       a.post_count
      ,count(a.user_id) as users_having_post_count
    from (
      select
         OwnerUserId as user_id
        ,count(Id) as post_count
      from Posts
      where OwnerUserId is not null
      group by OwnerUserId
    ) as a
    group by a.post_count
  ) as b
) as c
order by 1
;

Enter Parameters

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