1、先筛选重复,如
Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "日期"
For Each dr As DataRow In DataTables("表A").Select("", cs & " desc")
Dim flag As Boolean = False
If pdr IsNot Nothing Then
If format(pdr("日期"), "yyyyMM") <> format(dr("日期"), "yyyyMM") Then
flag = True
End If
End If
If flag OrElse pdr Is Nothing Then
If count > 1 Then
idx &= idx_temp
End If
count = 1
idx_temp = ""
Else
count += 1
idx_temp &= dr("_Identify") & ","
End If
pdr = dr
Next
If count > 1 Then
idx &= idx_temp
End If
Tables("表A").filter = "_Identify not in (" & idx.trim(",") & ")" '显示唯一值
2、得到的数据,你再进行分组统计,即可。