select sum(case when c < 10 then 1 else 0 end) '<10', sum...

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
sum(case when c < 10 then 1 else 0 end) '<10',
sum(case when c >= 10 and c < 20 then 1 else 0 end) '10-20',
sum(case when c >= 20 then 1 else 0 end) '>20'
from (
select OwnerUserId, count(*) c
from posts
where PostTypeId=1
group by OwnerUserId
) t1

Enter Parameters

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