各科的平均分不能正确统计,请老师看一下问题在哪里
Dim b As New SQLGroupTableBuilder("统计表1","学生成绩汇总表")
b.Groups.AddDef("班级")
b.Totals.AddExp("人数","学号","",AggregateEnum.Count) \'统计人数
Dim nms() As String = {"语文","数学","英语","物理","政治","历史","地理","生物"}
For Each nm As String In nms \'利用表达式统计及格人数和优秀人数
b.Totals.AddExp(nm & "_平均",AggregateEnum.Average)
b.Totals.Addexp(nm & "_及格", "iif(" & nm & " >= 60, 1, 0)")
b.Totals.Addexp(nm & "_优秀", "iif(" & nm & " >= 80, 1, 0)")
Next
b.VerticalTotal = True
b.Build()
For Each nm As String In nms \'对生成的统计表增加表达式列,计算及格率和优秀率
DataTables("统计表1").DataCols.Add(nm & "_及格率",Gettype(Double), nm & "_及格/人数" )
Tables("统计表1").Cols(nm & "_及格率").Move(Tables("统计表1").Cols(nm & "_及格").Index + 1)
DataTables("统计表1").DataCols.Add(nm & "_优秀率",Gettype(Double), nm & "_优秀/人数" )
Tables("统计表1").Cols(nm & "_优秀率").Move(Tables("统计表1").Cols(nm & "_优秀").Index + 1)
DataTables("统计表1").DataCols(nm & "_及格率").SetFormat("0.00%")
DataTables("统计表1").DataCols(nm & "_优秀率").SetFormat("0.00%")
Next
MainTable = Tables("统计表1")