a.id c_id p_type paid date
1 6 FLOUR 100.00 2015-06-22
2 7 OIL 50.00 2015-06-21
3 6 FLOUR 242.00 2015-06-24
4 6 FLOUR 392.00 2015-06-26
5 7 OIL 200.00 2015-07-29
6 7 OIL 300.00 2015-07-25
i have been trying to select only the sum of values from distinct tables, i tried
SELECT customer.first_name, customer.last_name, credit.quantity,
credit.date_supplied, credit.unit_price, credit.p_type,
ROUND(SUM(account.amount_paid))
AS amount_paid, account.date_paid FROM credit, customer
LEFT OUTER JOIN account
ON account.c_id = customer.c_id ;
I want to display the sum total of columns with product type flour and then that of oil but i only get a sum of the whole amount in the table. I would appreciate the help.