跳至主要內容

数据案例:销售交货数量汇总

五六零网校小于 1 分钟

根据销售订单汇总销售交货数量

SELECT T0.[BaseEntry], T0.[BaseLine], SUM(T0.[Quantity]) AS 'QTY'
		FROM DLN1 T0
		GROUP BY T0.[BaseEntry], T0.[BaseLine]

应用于销售订单表,示例销售订单行表为T1

  • 示例代码
LEFT JOIN (
		SELECT T0.[BaseEntry], T0.[BaseLine], SUM(T0.[Quantity]) AS 'QTY'
		FROM DLN1 T0
		GROUP BY T0.[BaseEntry], T0.[BaseLine]
	) TS
	ON TS.[BaseEntry] = t1.docentry
		AND TS.[BaseLine] = T1.[LineNum]