Dim d As Date = new Date(2020,4,1)
Dim g As New SQLCrossTableBuilder("统计表1", ("fsuf_pmc"))
g.ConnectionName = "t"
g.HGroups.AddExp("日期","convert(nvarchar(10),orderdate,120)")
g.VGroups.AddDef("gxda","{0}_下单")
g.Totals.AddExp("下单数量","jiquantity")
g.Filter = "orderdate >='" & d & "' and orderdate <'" & d.AddMonths(1) & "'"
Dim dt1 As fxDataSource
dt1 = g.BuildDataSource()
Dim g2 As New SQLCrossTableBuilder("统计表2", "fsuf_pmc")
g2.ConnectionName = "t"
g2.HGroups.AddExp("日期","convert(nvarchar(10),completedate,120)")
g2.VGroups.AddDef("gxda","{0}_完成")
g2.Totals.AddExp("完成数量","jiquantity")
g2.Filter = "completedate >='" & d & "' and completedate <'" & d.AddMonths(1) & "'"
'g2.Build
Dim dt2 As fxDataSource
dt2 = g2.BuildDataSource()
dt1.Combine("日期",dt2,"日期")
dt1.show("统计表1")
'以下代码为了重新排序列
Dim dics As new SortedDictionary(Of String, String)
For Each c As Col In Tables("统计表1").Cols
dics.add(c.Caption,c.Name)
Next
dics.remove("日期")
Dim str As String = "日期|90"
For Each key As String In dics.keys
str = str & "|" & dics(key) & "|90"
Next
Tables("统计表1").SetColVisibleWidth(str)
Tables("统计表1").sort = "日期"