我更喜欢这么搞
Dim bm As String = "统计"
Dim jb1 As New SQLJoinTableBuilder(bm,"表A")
jb1.AddCols("年","周","组别","'人数' As 分类","人数 as aa")
Dim jb2 As New SQLJoinTableBuilder(bm,"表A")
jb2.AddCols("年","周","组别","'产能' As 分类","产能 as aa")
Dim jb3 As New SQLJoinTableBuilder(bm,"表A")
jb3.AddCols("年","周","组别","'排单量' As 分类","排单量 as aa")
jb1.Union(jb2)
jb1.Union(jb3)
jb1.Build()
Dim b As New CrossTableBuilder(bm,jb1.BuildSql )
b.HGroups.AddDef("年")
b.HGroups.AddDef("周")
b.HGroups.AddDef("分类")
b.VGroups.AddDef("组别")
b.Totals.AddDef("aa")
b.Build
Tables(bm).AutoSizeCols
Tables(bm).MergeMode = MergeModeEnum.Standard
Tables(bm).MergeCols.Clear()
Tables(bm).MergeCols.Add("年")
Tables(bm).MergeCols.Add("周")
Tables(bm).MergeSort = "年,周"
Tables(bm).AllowMerge = True
MainTable = Tables(bm)