--18.查询各科成绩最高分.最低分和平均分:--以如下形式显示:-- 课程ID,课程name,最高分,最低分,平均分,及格率,中等率,优良率,优秀率--及格为>=60,中等为:70-80,优良为:80-90,优秀为:>=90--cast(cast (sum(case when c.score>=60 then 1 else 0 end)*100/(count(1)*1.0) as float) as nvarchar)+'%'及格率'--查询成绩表中三科成绩的最高分 等等select…
判断类似一个班级的男生和女生的人数,用sum (cese when then ) select count(er.execute_result), sum(case er.execute_result when 1 then 1 else 0 end) completed, sum(case er.execute_result when 0 then 1 else 0 end) notCompleted from taw_wp_execute_result er ; select (case w…
1. select sum(CASE WHEN A.[STATUS]=0 THEN 1 ELSE 0 end) as a1, sum(CASE A.[STATUS] WHEN 1 THEN 1 ELSE 0 end) as a2, sum(CASE A.[STATUS] WHEN 2 THEN 1 ELSE 0 end) as a3, A.UserId,C.TrainId from CoursewareLogMiddle A join LessonDetail B on A.Lesso…
在我们使用数据库的时候,可能会遇到需要进行统计的情况. 比如需要统计一下,下表中各个年份的胜负场数. 遇到这样的情况,我们应该怎么办呢? 在mysql中我们可以使用group by sum case when 来解决这个问题,sql语句如下: select date_year,sum(case when win_lose = '胜' then 1 else 0 end) win,sum(case when win_lose = '负' then 1 else 0 end) losefrom s…
This document describes how to install and configure Wordpress 4.0 on CentOS 7.0. WordPress started in 2003 with a single bit of code to enhance the typography of everyday writing and with fewer users than you can count on your fingers and toes. Sinc…