我在 SAP B1 中有一个 SQL 查询,列出了本周的销售额。我还有一个查询,对这些相同的销售额求和。如何组合查询,以便结果是所有销售行,总和显示为这些行下方的一行?
SQL 列表查询-
SELECT T0.[DocNum], T0.[DocDate],
T1.[CardName], T1.[CardFName], T0.[DocTotalSy] AS Total
FROM ORDR T0
INNER JOIN OCRD T1
ON T0.CardCode = T1.CardCode
WHERE T0.[DocDate] > (SELECT CONVERT(varchar(10), DATEADD(day, -6, GETDATE()), 101))
SQL Sum 查询-
SELECT SUM (T0.[DocTotalSy]) AS Total
FROM ORDR T0
INNER JOIN OCRD T1
ON T0.CardCode = T1.CardCode
WHERE T0.[DocDate] > (SELECT CONVERT(varchar(10), DATEADD(day, -6, GETDATE()), 101))