Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:下面这段代码 执行起来 速度很慢 要等待 帮忙看一下 谢谢

1楼
jswjyjf 发表于:2023/8/30 12:17:00
下面这段代码 执行起来 速度很慢 要等待 帮忙看一下 谢谢
''''
Dim exp As String  = "1=1"
Dim sq1 As String="selec 套数,入库, 出库,(isnull(套数,0)-isnull(出库,0)) as 结存, a.* from (SELEC * FROM 订单) a left join("
Dim sq2 As String="Selec  订单号, sum(入库) As 入库, sum(出库) As 出库 from (Selec 订单号, 数量 As 入库, 0 As 出库 from {成品入库单明细}  where " & exp & ""
'Dim sq3 As String="union all Selec 产品编码,0, 盈亏数量  from {盘点单明细} where " & exp & ""
'Dim sq4 As String="union all Selec 产品编码,0, 数量  from {调拨单明细} where " & ck1 & ""
'Dim sq5 As String="union all Selec 产品编码,数量, 0  from {调拨单明细} where " & ck2 & ""
Dim sq6 As String="union all Selec 订单号,0,数量  from {成品出库单明细} where " & exp & ") As d  group by 订单号) As b  on a.订单号 = b.订单号"
Tables(e.form.Name & "_Table1").fill(sq1 &sq2 &sq6,"wjhansdata",True)
Tables(e.form.Name & "_Table1").SetColVisibleWidth("订单号|98|日期|100|周别|180|订单PO号|180|成品料号|200|工令|180|套数|90|入库|90|出库|90|结存|128|")
 Tables(e.form.Name & "_Table1").DefaultRowHeight = 23
 Tables(e.form.Name & "_Table1").DataTable.AllowResizeRow=False
If Tables(e.form.Name & "_Table1").rows.count=0
    Tables(e.form.Name & "_Table1").GrandTotal = False
Else
    Tables(e.form.Name & "_Table1").Cols("出库").GrandTotal = True
    Tables(e.form.Name & "_Table1").Cols("入库").GrandTotal = True
    Tables(e.form.Name & "_Table1").Cols("结存").GrandTotal = True
    Tables(e.form.Name & "_Table1").Cols("套数").GrandTotal = True
    Tables(e.form.Name & "_Table1").GrandTotal = True '显示合计模式
End If
2楼
有点蓝 发表于:2023/8/30 13:40:00
如果加载的行多肯定慢的。

sql可以优化一下

select 入库, 出库,(isnull(套数,0)-isnull(出库,0)) as 结存, a.* from 订单 as a left join (Select 订单号, sum(数量) As 入库 from {成品入库单明细} group by 订单号) as b on a.订单号 = b.订单号 left join (Select 订单号,sum(数量) As 出库  from {成品出库单明细} group by 订单号) as c on a.订单号 = c.订单号
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 2 queries.