select ( case when age >= 25 then '25岁及以上' else '25岁以下' end ) as age_cut, count(id) from user_profile group by age_cut
两种写法都试了一下,感觉if()函数的方式很简洁,这种如果不熟写起来就难受。
select ( case when age >= 25 then '25岁及以上' else '25岁以下' end ) as age_cut, count(id) from user_profile group by age_cut
两种写法都试了一下,感觉if()函数的方式很简洁,这种如果不熟写起来就难受。