select count(t1.usersid1) as '<10', count(T2.usersid2) as...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

select count(t1.usersid1) as '<10', count(T2.usersid2) as '10<=...<=20', count(T3.usersid3) as '>20'
from
(Select users.id as usersid1
from Users
left join posts on Users.Id = Posts.owneruserID
group by users.id
HAVING Count(Posts.id) <10) T1

full JOIN
(Select users.id as usersid2
from Users
inner join posts on Users.Id = Posts.owneruserID
group by users.id
HAVING Count(Posts.id) between 10 and 20) T2
ON T1.usersid1 = T2.usersid2

full JOIN
( Select users.id as usersid3
from Users
inner join posts on Users.Id = Posts.owneruserID
group by users.id
HAVING Count(Posts.id) > 20) T3
ON T2.usersid2 = T3.usersid3

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results