一张学生表和一张班级表查询这个某个班的男生数sql该怎么写?

2025年05月05日 22:48
有1个网友回答
网友(1):

select count(*)
from 学生表 where class_id in (select class_id from 班级表 where grade=3 and class_no=5) and sex='男'
学生表中如果没有class_id,那么判断不出某些人属于哪个班,没法写