怎么统计学生信息的及格人数和不及格人数

有一个test数据库,里面有一张学员表student,有三个字段,calss,name,score,分别代表班级,姓名,成绩

查询每个班级的几个人数和不及格人数,输出格式是 class,及格人数,不及格人数

select class,

(select count(*) from student where class="stu".class and score>=60) jige,
(select count(*) from student where class="stu".class and score<60) bujige
from student stu group by class

 

//性能上,不知道怎么样。

posted @ 2014-04-05 00:15  joyfei  阅读(1214)  评论(0编辑  收藏  举报