mysql 不及格率

mysql 不及格率,第1张

select name, 

       100*sum(case 

                    when mark>=60 

                    then 1 else 0 

                end)/count(*) 及格率 

from score 

group by name

select convert(varchar(10),sum(case when (html+sql)/2>=60 and (html+sql)/2<80 then 1 else 0 end)*100.0/

stucount)+'%' as 及格率,

convert(varchar(10),sum(case when (html+sql)/2>=80 then 1 else 0 end)*100.0/stucount)+'%' as 优秀

from exam e,(select count(1) as stucount from stuinfo) a


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7285270.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-03
下一篇 2023-04-03

发表评论

登录后才能评论

评论列表(0条)

保存