select sum(case when usersCounter.counter < 10 then 1 els...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Portuguese Language

Q&A for linguists, teachers and learners wanting to discuss the finer points of the Portuguese language

select sum(case when usersCounter.counter < 10 then 1 else 0 end) as less10,
       sum(case when usersCounter.counter between 10 and 20 then 1 else 0 end) as between10and20,
       sum(case when usersCounter.counter > 20 then 1 else 0 end) as more20
from (
  select ( 
    select count(*)
    from Posts
    where Posts.OwnerUserId = Users.Id
    ) as counter
  from Users 
) as usersCounter

Enter Parameters

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