有一个表字段:学号,姓名,课程,成绩,班级如何在一条语句中查询某班某课程总人数和该课程及格人数?
即:select count(*) 总人数,(???) 及格人数 from cjb where bjmc='班级名称' and kcmc='课程名称'
请问上面红色标记的部分该怎么写?
谢谢!!!
即:select count(*) 总人数,(???) 及格人数 from cjb where bjmc='班级名称' and kcmc='课程名称'
请问上面红色标记的部分该怎么写?
谢谢!!!
解决方案 »
- The Connection descriptor used by the client was:127.0.0.1:1521:ORCL
- ORACLE初始化参数设置问题
- oracle 语句执行多次结果不相同,请高手帮忙
- AIX HACMP ORALCE 表空间满了,求助!!!
- 请教一个小学生级别的PLSQL插入记录问题,请大家帮忙;
- 高分请教oracle9中长字符串保存的问题
- 再进行imp时候出错: 错误1658出现,加大表空间仍然没有解决问题
- 请教一个日期相加问题
- [请问]XP是不是不能够安装Oracle8?
- Oracle 8i 中如何连接到别的机器上?
- 以汉字为条件查询无返回的问题
- 集群连接池的配置
(select cout(*) from cjb where bjmc='班级名称' and kcmc='课程名称'),
(select cout(*) from cjb where bjmc='班级名称' and kcmc='课程名称' and cj>=60)
from dual这种方式也不行,因为我的where后面的内容太多!
from cjb where bjmc='班级名称' and kcmc='课程名称'
select count(*) 总人数,sum(case when 成绩>=60 then 1 else 0 end) 及格人数
from cjb where bjmc='班级名称' and kcmc='课程名称'
你的用count 要这样
count(case when 成绩>=60 then 1 end) 及格人数
如果case 条件复杂了能不能这么写?
如(case where xh(select xh from xsb where xb='男') then 1 else 0 end)?
总是写错!该打!