题解 | #只有我一开始计数用的是 count(age)吗#

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

说来惭愧,计数count(age),得到的结果是0 ,null不计数,尴尬

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务