1)统计班级表里班级名等于123,班级人数,男生人数,女生人数;
select
count(*) AS SUM,
SUM( CASE WHE SEX='F' THEN 1 ELSE 0 END) AS F_num,
SUM( CASE WHE SEX='M' THEN 1 ELSE 0 END) AS M_num
FROM CLASS_TABLE WHERE CLASS_NAME ='123';
2023-12-03 18:13:22
1)统计班级表里班级名等于123,班级人数,男生人数,女生人数;
select
count(*) AS SUM,
SUM( CASE WHE SEX='F' THEN 1 ELSE 0 END) AS F_num,
SUM( CASE WHE SEX='M' THEN 1 ELSE 0 END) AS M_num
FROM CLASS_TABLE WHERE CLASS_NAME ='123';