select count(case when num.post <10 then 'a' end), count(...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Woodworking

Q&A for professional and amateur woodworkers

--select top 100 * from users
--select count(DisplayName) from users where DisplayName like '%John%' or DisplayName like '%Ivan%'
--select count(case when count(posts.OwnerUserId)<10 then '1' end), count(case when count(posts.OwnerUserId)>10 and count(posts.OwnerUserId)<20 then '2' end), count(case when count(posts.OwnerUserId)>20 then '3' end) from users left join posts on users.Id = posts.OwnerUserId group by users.Id
select count(case when num.post <10 then 'a' end), count(case when num.post >10 and num.post<20 then 'b' end), count(case when num.post>20 then 'c' end)  from (select count(posts.OwnerUserId) as post from users left join posts on users.Id = posts.OwnerUserId group by users.Id) as num

Enter Parameters

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