SELECT ISNULL(T1.KHMC, ‘总计‘)客户名称, ISNULL(T1.DJMC, ‘小计‘)单据名称, CAST(SUM(T1.SL) AS INT)数量 FROM ( SELECT vl.DM1, k.KHMC, vl.DJMC, vl.SL FROM VW_LSXHDMX AS vl INNER JOIN KEHU AS k ON k.CKDM = vl.DM1 ) T1 GROUP BY T1.KHMC , T1.DJMC WITH ROLLUP
时间: 2024-10-12 10:18:39