select a.cj, nvl(b.rs,0) rs1, nvl(c.rs,0) rs2, nvl(d.rs,0) rs3, nvl(e.rs,0) rs4 from ( select '99' cj from dual union select '95' cj from dual union select '90' cj from dual union select '85' cj from dual union select '80' cj from dual union select '75' cj from dual union select '70' cj from dual union select '60' cj from dual union select '50' cj from dual union select '40' cj from dual union select '20' cj from dual union select '0' cj from dual ) a left join (select cj ,count(cj) rs from (select b.njdm_id nj,case when cj='优秀' and mod(substr(a.xh_id,9,1),2)=1 then 95 when cj='优秀' and mod(substr(a.xh_id,9,1),2)=0 then 90 when cj='良好' and mod(substr(a.xh_id,9,1),2)=0 then 80 when cj='良好' and mod(substr(a.xh_id,9,1),2)=1 then 85 when cj='中等' and mod(substr(a.xh_id,9,1),2)=0 then 70 when cj='中等' and mod(substr(a.xh_id,9,1),2)=1 then 75 when cj='及格' then 60 when cj='不及格' then 50 when bfzcj>97 then 99 when bfzcj>=93 then 95 when bfzcj>=88 then 90 when bfzcj>=83 then 85 when bfzcj>=78 then 80 when bfzcj>=73 then 75 when bfzcj>=68 then 70 when bfzcj>=60 then 60 when bfzcj>=50 then 50 when bfzcj>=30 then 40 when bfzcj>=10 then 20 else 0 end cj from jw_cj_xscjb a,jw_xjgl_xsjbxxb b,zftal_xtgl_zydmb d where b.zyh_id=d.zyh and b.xz<>'3' and a.xh_id=b.xh_id and b.njdm_id='2023' and bfzcj>0 and a.cjbz is null ) group by cj ) b on a.cj=b.cj left join (select cj ,count(cj) rs from (select b.njdm_id nj,case when cj='优秀' and mod(substr(a.xh_id,9,1),2)=1 then 95 when cj='优秀' and mod(substr(a.xh_id,9,1),2)=0 then 90 when cj='良好' and mod(substr(a.xh_id,9,1),2)=0 then 80 when cj='良好' and mod(substr(a.xh_id,9,1),2)=1 then 85 when cj='中等' and mod(substr(a.xh_id,9,1),2)=0 then 70 when cj='中等' and mod(substr(a.xh_id,9,1),2)=1 then 75 when cj='及格' then 60 when cj='不及格' then 50 when bfzcj>97 then 99 when bfzcj>=93 then 95 when bfzcj>=88 then 90 when bfzcj>=83 then 85 when bfzcj>=78 then 80 when bfzcj>=73 then 75 when bfzcj>=68 then 70 when bfzcj>=60 then 60 when bfzcj>=50 then 50 when bfzcj>=30 then 40 when bfzcj>=10 then 20 else 0 end cj from jw_cj_xscjb a,jw_xjgl_xsjbxxb b,zftal_xtgl_zydmb d where b.zyh_id=d.zyh and b.xz<>'3' and a.xh_id=b.xh_id and b.njdm_id='2022' and bfzcj>0 and a.cjbz is null ) group by cj ) c on a.cj=c.cj left join (select cj ,count(cj) rs from (select b.njdm_id nj,case when cj='优秀' and mod(substr(a.xh_id,9,1),2)=1 then 95 when cj='优秀' and mod(substr(a.xh_id,9,1),2)=0 then 90 when cj='良好' and mod(substr(a.xh_id,9,1),2)=0 then 80 when cj='良好' and mod(substr(a.xh_id,9,1),2)=1 then 85 when cj='中等' and mod(substr(a.xh_id,9,1),2)=0 then 70 when cj='中等' and mod(substr(a.xh_id,9,1),2)=1 then 75 when cj='及格' then 60 when cj='不及格' then 50 when bfzcj>97 then 99 when bfzcj>=93 then 95 when bfzcj>=88 then 90 when bfzcj>=83 then 85 when bfzcj>=78 then 80 when bfzcj>=73 then 75 when bfzcj>=68 then 70 when bfzcj>=60 then 60 when bfzcj>=50 then 50 when bfzcj>=30 then 40 when bfzcj>=10 then 20 else 0 end cj from jw_cj_xscjb a,jw_xjgl_xsjbxxb b,zftal_xtgl_zydmb d where b.zyh_id=d.zyh_id and b.xz<>'3' and a.xh_id=b.xh_id and b.njdm_id='2021' and bfzcj>0 and a.cjbz is null  ) group by cj ) d on a.cj=d.cj left join (select cj ,count(cj) rs from (select b.njdm_id nj,case when cj='优秀' and mod(substr(a.xh_id,9,1),2)=1 then 95 when cj='优秀' and mod(substr(a.xh_id,9,1),2)=0 then 90 when cj='良好' and mod(substr(a.xh_id,9,1),2)=0 then 80 when cj='良好' and mod(substr(a.xh_id,9,1),2)=1 then 85 when cj='中等' and mod(substr(a.xh_id,9,1),2)=0 then 70 when cj='中等' and mod(substr(a.xh_id,9,1),2)=1 then 75 when cj='及格' then 60 when cj='不及格' then 50 when bfzcj>97 then 99 when bfzcj>=93 then 95 when bfzcj>=88 then 90 when bfzcj>=83 then 85 when bfzcj>=78 then 80 when bfzcj>=73 then 75 when bfzcj>=68 then 70 when bfzcj>=60 then 60 when bfzcj>=50 then 50 when bfzcj>=30 then 40 when bfzcj>=10 then 20 else 0 end cj from jw_cj_xscjb a,jw_xjgl_xsjbxxb b,zftal_xtgl_zydmb d where b.zyh_id=d.zyh and b.xz<>'3' and a.xh_id=b.xh_id and b.njdm_id='2020' and bfzcj>0 and a.cjbz is null ) group by cj ) e on a.cj=e.cj order by cj desc

      

                当前统计:全校全部课程成绩分布