|
SELECT 交叉表.产品编号之最后一条记录, 交叉表.时间, 交叉表.自定编号, 交叉表.产品ID, 交叉表.年度, 交叉表.月份, 交叉表.年度ID, 交叉表.月份ID, 交叉表.产品名称, [期初库存]+nz(DSum("生产","交叉表","产品ID =" & 交叉表!产品ID & " And 年度ID<" & 交叉表!年度ID)*1)-nz(DSum("销售","交叉表","产品ID =" & 交叉表!产品ID & " And 年度ID<" & 交叉表!年度ID)*1) AS 前期, 交叉表.生产, 交叉表.销售, (DSum("生产","交叉表","产品ID =" & 交叉表!产品ID & " And 年度ID=" & 交叉表!年度ID & " And 月份ID<=" & 交叉表!月份ID)*1) AS 生产累计, (DSum("销售","交叉表","产品ID =" & 交叉表!产品ID & " And 年度ID=" & 交叉表!年度ID & " And 月份ID<=" & 交叉表!月份ID)*1) AS 销售累计, [前期]+nz([生产累计])-nz([销售累计]) AS 库存
FROM 交叉表
ORDER BY 交叉表.产品ID DESC , 交叉表.年度ID, 交叉表.月份ID;
|
|