Q&A for professional robotic engineers, hobbyists, researchers and students
select case WHEN p.cnt_post = 0 THEN '0' WHEN p.cnt_post between 1 AND 10 THEN '1- 10' WHEN p.cnt_post > 10 THEN '> 10' END as vysledek from users u join (select count(*) as cnt_post,owneruserid from posts p group by p.owneruserid) p on u.id = p.owneruserid --(select count(*) as total_user from users) total group by case WHEN p.cnt_post = 0 THEN '0' WHEN p.cnt_post between 1 AND 10 THEN '1- 10' WHEN p.cnt_post > 10 THEN '> 10' END