数据案例:采购收货数量汇总
小于 1 分钟
根据采购订单汇总采购收货数量
SELECT T0.[BaseEntry], T0.[BaseLine], SUM(T0.[Quantity]) AS 'QTY'
FROM PDN1 T0
GROUP BY T0.[BaseEntry], T0.[BaseLine]
应用于采购订单表,示例采购订单行表为T1
- 示例代码
LEFT JOIN (
SELECT T0.[BaseEntry], T0.[BaseLine], SUM(T0.[Quantity]) AS 'QTY'
FROM PDN1 T0
GROUP BY T0.[BaseEntry], T0.[BaseLine]
) TS
ON TS.[BaseEntry] = t1.docentry
AND TS.[BaseLine] = T1.[LineNum]