这里我犯错的地方在于给case when加了括号,这里case when别名不能加括号,直接别名跟在后面就行
select
case
when age>50 then '50以上'
when age>=20 then '20-50'
when age<20 then '20以下'
else '未填写'
end age_group
,count(customer_id) as user_count
from customers_info
group by age_group