主题:[讨论]老问题,新挑战,成绩的分析统计
coffeenight
[专家分:230] 发布于 2010-04-20 11:36:00
需要每个院系都生成各自的所属科目的成绩分析统计表,xls格式
含以下字段,科目代码,科目名称,应考人数,实考人数,缺考率,最高分,最低分,平均分,130以上人数,130-110,110-100,100-90,90-80,80-70,70-60,60-50,50分以下
现在的主要问题是各分数段的统计如何实现?及如何生成各学院的成绩统计表
PS:(分析统计是按科目统计,统计完成再按学院进行集合生成xls表)
有进来的朋友都请说说您的意见建议。谢谢!
最后更新于:2010-04-20 11:36:00
回复列表 (共6个回复)
沙发
Vii [专家分:1130] 发布于 2010-04-20 12:24:00
我觉得你是否把表的个字段名代表什么意思说明下,这样有利于大家提供意见.
板凳
coffeenight [专家分:230] 发布于 2010-04-20 14:54:00
表里 yxsdm: 学院代码
zzllm: 政治理论码
zzllmc: 政治理论名称
zzll: 政治理论成绩
ywk1m,ywk1mc,ywk1 分别就是 业务课一码,业务课一名称,业务课一成绩
ywk2m..... 与业务课一类似
成绩字段中:缺考是标记-1,违规-2,作弊-3,谢谢
3 楼
Vii [专家分:1130] 发布于 2010-04-20 16:59:00
.
4 楼
coffeenight [专家分:230] 发布于 2010-04-20 17:21:00
SELECT yxsdm,yxsmc,zydm,zymc,wgym as ywkdm,wgymc as ywkmc,wgy as ywkcj from quan where wgym<>'20' and ksfsm='21';
union all;
SELECT yxsdm,yxsmc,zydm,zymc,ywk1m as ywkdm,ywk1mc as ywkmc,ywk1 as ywkcj from quan where ksfsm='21';
union all;
select yxsdm,yxsmc,zydm,zymc,ywk2m as ywkdm,ywk2mc as ywkmc,ywk2 as ywkcj from quan where ksfsm='21' into curs cjk
SELECT ywkdm,ywkmc,count(ywkdm) as 应考人数,sum(IIF(ywkcj>0,1,0)) as 实考人数,sum(IIF(ywkcj=-1,1,0))*100/coun(ywkdm) as 缺考率,MAX(ywkcj) as 最高分,MIN(ywkcj)as 最低分,avg(ywkcj)as 平均分, ;
sum(IIF(BETWEEN(ywkcj,130,150),1,0)) as betw130_150,sum(IIF(BETWEEN(ywkcj,110,129),1,0)) as betw110_129,sum(IIF(BETWEEN(ywkcj,100,109),1,0)) as betw100_109,sum(IIF(BETWEEN(ywkcj,90,99),1,0)) as betw90_99,sum(IIF(BETWEEN(ywkcj,80,89),1,0)) as betw80_89,sum(IIF(BETWEEN(ywkcj,70,79),1,0)) as betw70_79,sum(IIF(BETWEEN(ywkcj,60,69),1,0)) as betw60_69,sum(IIF(BETWEEN(ywkcj,50,59),1,0)) as betw50_59,sum(IIF(BETWEEN(ywkcj,-3,49),1,0)) as betw49;
from cjk grou by ywkdm
目前进度,呵
统计最低分的时候,因为缺考是标记-1,违规-2,作弊-3,,min() 的时候和统计平均分的时候,就得不到正确结果.。。这个该如何解决?
另一个问题是,各院系该如何获取自己考试科目的分析统计结果,并生成xls表。
5 楼
Vii [专家分:1130] 发布于 2010-04-20 17:53:00
我今天脑袋混掉了,IIF都忘记. 帮顶[em10]
6 楼
coffeenight [专家分:230] 发布于 2010-04-21 17:56:00
SELECT yxsdm,yxsmc,zydm,zymc,wgym as ywkdm,wgymc as ywkmc,wgy as ywkcj from quan where wgym<>'20' and ksfsm='21';
union all;
SELECT yxsdm,yxsmc,zydm,zymc,ywk1m as ywkdm,ywk1mc as ywkmc,ywk1 as ywkcj from quan where ksfsm='21';
union all;
select yxsdm,yxsmc,zydm,zymc,ywk2m as ywkdm,ywk2mc as ywkmc,ywk2 as ywkcj from quan where ksfsm='21' into curs cjk
SELECT IIF(yxsdm$'014,028,104',yxsdm,LEFT(yxsdm,2)+' ')as yxsdm,yxsmc,ywkdm,ywkmc from cjk where ywkdm<>'-' or ywkdm<>'0' grou by yxsdm,ywkdm order by yxsdm,ywkdm into curs yxs
SELECT * from cjk where ywkcj>0 and ywkdm<>'30' and ywkdm<>'31' into curs cjk_fx
SELECT yxsdm,yxsmc,ywkdm,ywkmc,count(ywkdm) as 应考人数,sum(IIF(ywkcj>0,1,0)) as 实考人数,sum(IIF(ywkcj=-1,1,0))*100/coun(ywkdm) as 缺考率;
from cjk grou by ywkdm into curs quekaolv
SELECT yxsdm,ywkdm,ywkmc,MAX(ywkcj) as 最高分,MIN(ywkcj)as 最低分,avg(ywkcj)as 平均分, ;
sum(IIF(BETWEEN(ywkcj,130,150),1,0)) as betw130_150,sum(IIF(BETWEEN(ywkcj,110,129),1,0)) as betw110_129,sum(IIF(BETWEEN(ywkcj,100,109),1,0)) as betw100_109,sum(IIF(BETWEEN(ywkcj,90,99),1,0)) as betw90_99,sum(IIF(BETWEEN(ywkcj,80,89),1,0)) as betw80_89,sum(IIF(BETWEEN(ywkcj,70,79),1,0)) as betw70_79,sum(IIF(BETWEEN(ywkcj,60,69),1,0)) as betw60_69,sum(IIF(BETWEEN(ywkcj,50,59),1,0)) as betw50_59,sum(IIF(BETWEEN(ywkcj,-3,49),1,0)) as less50;
from cjk_fx grou by ywkdm into curs fx
SELECT 应考人数,实考人数,缺考率,b.* from quekaolv a,fx b where a.ywkdm=b.ywkdm into curs cjfx
SELECT yxs.yxsdm,yxs.yxsmc,cjfx.* from yxs,cjfx where yxs.ywkdm=cjfx.ywkdm order by yxs.yxsdm,yxs.ywkdm into curs jieguo1
SELECT * from jieguo1 grou by yxsdm_a,ywkdm into curs jieguo
SELECT jieguo
dm=jieguo.yxsdm_a
mc=jieguo.yxsmc
SCAN
IF dm<>jieguo.yxsdm_a
SELECT ywkdm as 科目代码,ywkmc as 科目名称,应考人数,实考人数,缺考率,最高分,最低分,平均分,betw130_150,betw110_129,betw100_109,betw90_99,betw80_89,betw70_79,betw60_69,betw50_59,less50;
from jieguo where jieguo.yxsdm_a=dm noconsole
COPY TO &mc type xl5
dm=jieguo.yxsdm_a
mc=jieguo.yxsmc
ELSE
dm=jieguo.yxsdm_a
mc=jieguo.yxsmc
ENDIF
ENDSCAN
呵呵,暂时就这样吧,留下代码,供和我一样的初学者参考
我来回复