Hi,I have 3 tables customer(cid, name, phone) and transactions (cid (reference), fundid, date, shares) and fund (fundid, fund_name).I am trying to write an sql query that would get me the total number of shares for each customer for each fund.Here are the sample inserts:INSERT INTO CUSTOMER(1, 'Alex', '123456678');INSERT INTO CUSTOMER(2, 'Bill', '6323450236');INSERT INTO CUSTOMER(3, 'Marie', '8568289912');INSERT INTO FUND (1, 'Docotel');INSERT INTO FUND (2, 'Armen');INSERT INTO FUND (3, 'TD');INSERT INTO TRANSACTIONS(1, 2, '2010-2-12', 234); (means shares bought)INSERT INTO TRANSACTIONS(3, 1, '2010-4-2', 192);INSERT INTO TRANSACTIONS(1, 2, '2010-4-22', -45); (the '-' means shares sold) INSERT INTO TRANSACTIONS(1, 3, '2010-4-26', 220);INSERT INTO TRANSACTIONS(3, 2, '2010-7-21', 170);
I want the sql result to look something like this:Name| Fund_Name | Total_Shares |Alex Docotel 189Alex TD 220Marie Docotel 192Marie Armen 170Thanks