I've 3 tables in MS Access
- 1st table saves the suppliers details with opening balance (may or may not be)
- 2nd table saves the purchases made by suppliers which stores their ID and Total_Amount
- 3rd table keeps track of the payments made by suppliers which stores their ID and Paid_Amount
I've created a query that sums the opening balance from Table 1 and Total_Amount from Table 2 and also subtracts Paid_Amount from Table 3
And it is working fine only if any payment is made the supplier name is reflecting.
I want a query which shows even if any purchase is made or not reflect the supplier name.
The Query is:
SELECT Sl_No, Supplier_Name, SUM(Opening_Balance+Total_Amount-Paid_Amount) AS TOTAL
FROM Ledger_Suppliers, Transaction_Payments, Transaction_Purchases
WHERE Transaction_Payments.Supplier_ID = Ledger_Suppliers.Sl_No
AND Transaction_Purchases.Supplier_ID = Ledger_Suppliers.Sl_No
GROUP BY Sl_No, Supplier_Name
And result is: