select nnd as '年龄段',sum(人数) as '年龄段人数' from ( select case when 年龄>21 and 年龄<=25 then '21-25' when 年龄>26 and 年龄<=30 then '26-30' when 年龄>31 and 年龄<=35 then '31-35' when 年龄>36 and 年龄<=40 then '36-40' else 'other' end as nnd,人数 from (select count(年龄) as 人数,年龄 from (SELECT 姓名,`出生日期`,FLOOR(DATEDIFF(CURDATE(),`出生日期`)/365.2422) as 年龄 from `TABLE 19`) as c group by c.年龄) as b ) a group by nnd

年龄段年龄段人数
21-254
26-3012
31-3518
36-4090
other182
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐