select groups, cast(count_in_group as float)/cast(total_u...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

select
groups,
cast(count_in_group as float)/cast(total_user_count as float) as percentage
from(

select groups,
total_user_count,
count(Id) as count_in_group

from (
select Id,
  case when "post_count" = 0 then '0'
  when "post_count" > 0 and "post_count" <= 10 then '1-10'
  when "post_count" > 10 then '10+' end as groups,
  (select count(Id) from Users) as "total_user_count"
  from
  (

select u.Id, count(p.Id) as "post_count" 

from Users u
full outer join Posts p on (p.OwnerUserID = u.Id)
group by u.Id)t
)t2
group by groups,total_user_count
)t3
;

Enter Parameters

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