最近看了狐表自带的排名统计例子,如果是统计一个学校的感觉还不错,如果要统计几所,甚至是几十所学校的可能要增加一些排名的项目,在原来的基础上每一科加上校排名(或者是年级排名)和县排名,总分的排名也加上校排名和县排名,不知道下面的这组公式怎么修改才符合要求:
Dim bjs As List(Of String) = DataTables("成绩表").GetUniqueValues("[班级] Is Not NULL","班级")
Dim Count As Integer
Dim ColNames() As String = {"语文","数学","英语","化学","物理","总分"}
Dim TotalName As String
For Each ColName As string In ColNames '
For i As Integer = 0 To bjs.Count -1
Dim drs As List(Of DataRow) = DataTables("成绩表").Select("[班级] = " & bjs(i), ColName & " DESC")
Count = 0
TotalName = ColName & "班排名"
For n As Integer = 0 To drs.Count - 1
Count = Count + 1
If n > 0 AndAlso drs(n)(ColName ) = drs(n-1)(ColName) Then
drs(n)(TotalName ) = drs(n-1)(TotalName )
Else
drs(n)(TotalName ) = Count
End If
Next
Next
Next
Tables("成绩表").Sort = "总分 DESC"
请高手指点一二,谢谢啦
[此贴子已经被作者于2011-10-7 11:23:26编辑过]