select case when age < 25&nbs***bsp;age is null then '25岁以下' when age >= 25 then '25岁及以上' end age_cut, count(*) as number from user_profile group by age_cut
case函数格式
case
when *条件* then *内容*
end *别名*
作用:可作为限制条件写在select中
select case when age < 25&nbs***bsp;age is null then '25岁以下' when age >= 25 then '25岁及以上' end age_cut, count(*) as number from user_profile group by age_cut