看这个,N多列都可以。
Dim jb As New SQLJoinTableBuilder("查询表1","品种销售登记表")
jb.C onnection Name = ""
jb.AddCols("日期","店铺 as 店名","名称1 as 名称","价格1 as 价格")
jb.Filter = "1<>1"
Dim lms As String = "名称1/价格1|名称2/价格2" '这里可以动态的
For Each lm As String In lms.Split("|")
Dim jb1 As New SQLJoinTableBuilder("查询表1","品种销售登记表")
jb1.C onnection Name = ""
jb1.AddCols("日期","店铺 as 店名",lm.Split("/")(0) & " As 名称",lm.Split("/")(1) & " As 价格")
jb1.Filter = lm.Split("/")(0) & " = '红富士'"
jb.Union(jb1)
Next
jb.Build()
MainTable = Tables("查询表1")
[此贴子已经被作者于2016/12/25 15:33:45编辑过]