TbGoods表显示为一片空白,原因:http://www.foxtable.com/webhelp/scr/1906.htm
这个貌似也就是是一些既有数据的汇总而已,没看到需要做什么二次加工,没有必要什么多线程吧。直接一条sql语句就行了
Select a.id,a.code,b.AlterA As TotalAlterA from TbGoods As a
left join (Select GoodsID,sum(AlterA) As AlterA
from TbAlter where [Date] >= #2018-02-01# And [Date] < #2018-03-01# group by GoodsID ) As b
on a.ID= b.GoodsID
TbRK表没有数据,也没有看到有日期列,所以没有处理,自己参考上面TbAlter 的方式做即可,如
Select a.id,a.code,b.AlterA As TotalAlterA,c.CurA from TbGoods As a
left join (Select GoodsID,sum(AlterA) As AlterA
from TbAlter where [Date] >= #2018-02-01# And [Date] < #2018-03-01# group by GoodsID ) As b
on a.ID= b.GoodsID
left join (Select GoodsID,sum(A) As CurA
from TbRK where [Date] >= #2018-02-01# And [Date] < #2018-03-01# group by GoodsID ) As c
on a.ID= c.GoodsID