Foxtable(狐表)用户栏目专家坐堂 → 如何把多个查询结果直接组合在一起,不通过连接列


  共有7619人关注过本帖树形打印复制链接

主题:如何把多个查询结果直接组合在一起,不通过连接列

帅哥哟,离线,有人找我吗?
chenpan
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:133 积分:1199 威望:0 精华:0 注册:2012/4/18 9:54:00
如何把多个查询结果直接组合在一起,不通过连接列  发帖心情 Post By:2012/6/20 23:49:00 [显示全部帖子]

如何把多个查询结果直接组合在一起,不通过连接列

 

 Dim jb As New SQLJoinTableBuilder("查询表1","日常废品录入")
    jb.C
     jb.AddExp("总废_数量","sum(废品数量)")
    jb.AddExp("总废_数量","sum(废品数量)")
    jb.AddExp("总废_重量","sum(废品总重)")
    jb.Filter="{日常废品录入}.录入时间 between # "  & dts  & " # And # " & dte & "# and {日常废品录入}.生产线f In (" & s & ") and {日常废品录入}.材质规格f In (" & s1 & ")"
    Dim fx As fxDataSource
    fx=jb.BuildDataSource
    Dim jb3 As New SQLJoinTableBuilder("查询表4","日常废品录入")
    jb3.C
        
    jb3.AddExp("内废_数量","sum(废品数量)")
    jb3.AddExp("内废_重量","sum(废品总重)")
    jb3.Filter="{日常废品录入}.录入时间 between # "  & dts  & " # And # " & dte & "# and {日常废品录入}.生产线f In (" & s & ") and {日常废品录入}.材质规格f In (" & s1 & ") and {日常废品录入}.发生工序 <> '成工退废' "
    Dim fx3 As fxDataSource
    fx3=jb3.BuildDataSource
 Dim jb1 As New SQLJoinTableBuilder("查询表2","日常废品录入")
    jb1.C
       jb1.AddExp("外废_数量","sum(废品数量)")
    jb1.AddExp("外废_重量","sum(废品总重)")
    jb1.Filter="{日常废品录入}.录入时间 between # "  & dts  & " # And # " & dte & "# and {日常废品录入}.生产线f In (" & s & ") and {日常废品录入}.材质规格f In (" & s1 & ") and {日常废品录入}.发生工序 = '成工退废' "
    Dim fx1 As fxDataSource
    fx1=jb1.BuildDataSource

 

 


    Dim jb2 As New SQLJoinTableBuilder("查询表3","生产统计表")
    jb2.C
        
    jb2.AddExp("生产总数_数量","sum(生产数量)")
    jb2.AddExp("生产总重_重量","sum(生产总重)")
    jb2.Filter="{生产统计表}.录入时间 between # "  & dts  & " # And # " & dte & "# and {生产统计表}.生产线s In (" & s & ") and {生产统计表}.材质规格s In (" & s1 & ")"
    Dim fx2 As fxDataSource
    fx2=jb2.BuildDataSource
   
jb2.Merge(jb) '组合jb2
jb2.Merge(jb1)
jb2.Merge(jb3)

   
    Tables("废品分布图表分析_Table2").DataSource =jb.BuildDataSource
    'Tables("废品分布图表分析_Table2").AutoSizeCols()


 回到顶部