select
age_group,
count(age_group) as user_count
from(
select
*,
case when age<20 then '20以下'
when age>=20 and age<=50 then '20-50'
when age>50 then '50以上'
else '未填写'
end as age_group
from
customers_info
) a
group by
age_group

京公网安备 11010502036488号