我有两个 SELECT 语句给出值“TotalSales”和“VendorPay_Com”。我希望能够在一个 MySQL 语句中从 TotalSales 中减去 VendorPay_Com 以获得值“Outstanding_Funds”,但我还没有找到一种可靠的方法来做到这一点。
这是我的两个陈述:
查询一:
SELECT SUM(Price) AS TotalSales
FROM PROPERTY
WHERE Status = 'Sold';
查询 2:
SELECT SUM(AC.Amount) AS VendorPay_Comm
FROM (
SELECT Amount FROM lawyer_pays_vendor
UNION ALL
SELECT CommissionEarned AS `Amount` FROM COMMISSION AS C WHERE C.`status` = 'Paid') AS AC
对此事的任何帮助将不胜感激:)