Last post Sep 04, 2016 11:44 AM by PatriceSc
Sep 04, 2016 11:28 AM|hotchocolate|LINK
my out put now -
and the sql for that -
SELECT CUSTOMER.CID AS Customer_ID, SALES.Total_Paid AS Total_payments
FROM CUSTOMER INNER JOIN SALES ON CUSTOMER.CID = SALES.CID;
but the output should be that, but the cutomer id no. 1 currency value must be added with each other to just show the total of no.1 then 2, 3 and 4
any help will be appreciated!
Sep 04, 2016 11:44 AM|PatriceSc|LINK
So it seems you want :
SELECT CUSTOMER.CID AS Customer_ID, SUM(SALES.Total_Paid) AS Total_payments
FROM CUSTOMER INNER JOIN SALES ON CUSTOMER.CID = SALES.CID
GROUP BY CUSTOMER.CID
See "GROUP BY" and "aggregation functions" in the documentation for you database. In short it allows to group rows together and to perform calculations on each group.