I'm stucked for a long while and unable to find whats wrong with my query, there is something wrong with my debit column in LEFT JOIN which is show in Query Result image in given below. The actual value of my debit table is 500 but MYSQL query display as 1500.
What am I doing wrong here. Kindly help me please.
This is my customers table
This is my cust_credit table
This is my cust_debit table
MYSQL Query is given following
SELECT
customers.id as id,
customers.cust_name AS customer_name,
SUM(cust_debit.debit_amount) as debit,
SUM(cust_credit.credit_amount) as credit,
(SUM(cust_debit.debit_amount)) - (SUM(cust_credit.credit_amount)) as balance
FROM customers
LEFT JOIN cust_debit ON customers.id = cust_debit.cust_id
LEFT JOIN cust_credit ON customers.id = cust_credit.cust_id
GROUP BY customers.id
ORDER BY customers.id
My Query Result is given following



