老师想求优秀率?请老师指教,谢谢!
Dim t As Table = e.Form.controls("Table1").Table
e.Form.controls("NavBar1").SelectedPage.Butt
Dim b As New sqlGroupTableBuilder("统计表1","Se lect c.学期,班级,考试名称,c.学生编号,学生姓名,学科,卷面分数,学生分数,Round(学生分数/卷面分数*100,2) As 折合分数 Fr om ({学生基本信息} a Inner JOIN {学生缴费} b ON b.学生编号 = a.学生编号) Inner JOIN {学生成绩} c ON c.学期 = b.学期 And c.学生编号 = b.学生编号 Where c.学期 = '20191' And 考试名称 = '抽考'","")
b.Groups.AddDef("班级")
b.Groups.AddDef("学科")
b.Totals.AddDef("学生编号",AggregateEnum.Count,"学生数")
b.Totals.AddDef("学生分数",AggregateEnum.Max,"最高分")
b.Totals.AddDef("学生分数",AggregateEnum.Min,"最低分")
b.Totals.AddDef("学生分数",AggregateEnum.Sum,"总分")
b.Totals.AddDef("学生分数",AggregateEnum.Average,"平均分")
b.Totals.AddExp("参考数","iif(学生分数 Is Not Null,1,0)")
b.Totals.AddExp("缺考数","iif(学生分数 Is Null,1,0)")
b.Totals.AddExp("优秀数","iif(Left(班级,1) = '1' And 折合分数 > 90,1,iif(Left(班级,1) = '2' And 折合分数 > 85,1,iif((Left(班级,1) = '3' Or Left(班级,1) = '4' Or Left(班级,1) = '5' Or Left(班级,1) = '6') And 折合分数 > 80,1,iif((Left(班级,1) = '7' Or Left(班级,1) = '8' Or Left(班级,1) = '9') And 折合分数 > 75,1,0))))")
b.Totals.AddExp("及格数","iif(学生分数 >= 60,1,0)")
b.Totals.AddExp("不及格数","iif(学生分数 < 60,1,0)")
b.Totals.AddExp("优秀率","iif(Left(班级,1) = '1' And 折合分数 > 90,1,iif(Left(班级,1) = '2' And 折合分数 > 85,1,iif((Left(班级,1) = '3' Or Left(班级,1) = '4' Or Left(班级,1) = '5' Or Left(班级,1) = '6') And 折合分数 > 80,1,iif((Left(班级,1) = '7' Or Left(班级,1) = '8' Or Left(班级,1) = '9') And 折合分数 > 75,1,0))))/iif(学生分数 Is Not Null,1,0)")
b.Totals.AddExp("学生分数分布_60以下","iif(学生分数 < 60,1,0)")
b.Totals.AddExp("学生分数分布_60-70","iif(学生分数 >= 60 And 学生分数 < 70,1,0)")
t.DataSource = b.BuildDataSource()