如何统计不同条件的年龄段的人数比如:级别为“正厅”,同时年龄在50—55岁之间的人数。

来源:百度知道 编辑:UC知道 时间:2024/05/29 00:33:08

select count(*),级别 where 年龄 between 50 and 55
group by 级别
这样可以统计出年龄在50到55之间的各个级别的人数

select count(*) from table where 级别='正厅' and 年龄 between 50 and 55

select count(*) from table group by 级别 having 级别='正厅'and 年龄>=50 and 年龄<=55

select count(正厅) from 表名 where age>50 and age<55 group by 级别