以下查询返回所有具有贷方余额(列 ID 和总计)的客户 - 有没有办法只返回总计的总和?
SELECT Customer_ID AS 'ID',
(
SELECT SUM(Credit) - SUM(Debit)
FROM A_Sales_Ledger
WHERE Document_Date <= '2013-09-30'
AND Customer_ID = ID
) AS 'Total'
FROM A_Sales_Ledger
WHERE Total > 0
GROUP BY Customer_ID