Can anyone help with mysql query that show multiple fields based on their calculation.
I have the following data:
ID | Supplier | Total | Tax | Shipping | Paid
1 | 2 | 100 | 10 | 5 | 0
2 | 2 | 50 | 5 | 2.5 | 1
Now I want a result like the following:
Supplier | Total Paid | Total Unpaid
2 | 57.5 | 115
My query as follow (so far)
SELECT suppliers.company, SUM(tax+shipping+total) as unpaid FROM poreceived LEFT JOIN suppliers ON suppliers.id = poreceived.supplierid WHERE paid = '0' GROUP BY supplierid
I don't now how to show the paid value.
Any help is appreciated.