日期:2014-05-17 浏览次数:20477 次
select '语文3',
round(sum(CASE WHEN 语文>=70.5 THEN 语文 ELSE 0 END)/count(1)*100,2) as 优秀率,
round(sum(CASE WHEN 语文>=58 THEN 语文 ELSE 0 END)/count(1)*100,2) as 良好率,
round(sum(CASE WHEN 语文>=48 THEN 语文 ELSE 0 END)/count(1)*100,2) as 及格率,
round(avg(语文),2) as 平均分
from cj
where 班级='26'
select '语文3',
round(sum(CASE WHEN 语文>=70.5 THEN 1 ELSE 0 END)/count(1)*100,2) as 优秀率, round(sum(CASE WHEN 语文>=58 THEN 1 ELSE 0 END)/count(1)*100,2) as 良好率, round(sum(CASE WHEN 语文>=48 THEN 1 ELSE 0 END)/count(1)*100,2) as 及格率,
round(avg(语文),2) as 平均分
from cj where 班级='26'
SELECT '语文3' ,
ROUND(SUM(CASE WHEN 语文 >= 70.5 THEN 1
ELSE 0
END) / ( COUNT(*) * 100 ), 2) AS 优秀率
FROM cj
WHERE 班级 = '26'