如果对sql语句不熟悉的话,也可以foxtable现有知识,也很简单。
Dim b As New SQLGroupTableBuilder("统计表1","表A")
Dim d As fxDataSource
b.Groups.AddExp("姓名","前片")
b.Totals.AddExp("前片","件数")
d = b.BuildDataSource()
Dim lms As String = "后片|四线|车线"
For Each lm As String In lms.Split("|")
Dim b1 As New SQLGroupTableBuilder("统计表1","表A")
Dim d1 As fxDataSource
b1.Groups.AddExp("姓名",lm)
b1.Totals.AddExp(lm,"件数")
d1 = b1.BuildDataSource()
d.Combine("姓名",d1,"姓名")
Next
d.Show("统计表1")
Tables("统计表1").AutoSizeCols
MainTable = Tables("统计表1") '打开生成的统计表
[此贴子已经被作者于2015/6/15 23:43:54编辑过]