case-when-then ╰+哭是因爲堅強的太久メ 2022-01-20 06:57 270阅读 0赞 select t.ageRang, count(t.ageRang) as totalCount from ( select patient_name, case when patient_age >= 20 and patient_age <= 29 then '20-29岁' when patient_age > 29 and patient_age <=39 then '30-39岁' when patient_age > 39 and patient_age <= 49 then '40-49岁' when patient_age > 49 and patient_age <=59 then '50-69岁' when patient_age > 59 then '60岁及以上' when (patient_age < 20 or age_unit in ('月', '天')) then '20岁以下' else '其它' end as ageRang from online_academic_data where online_academic_id ='719' ) t group by t.ageRang 复制代码
还没有评论,来说两句吧...