The table below shows a customer name alongside the salesperson commission for each transaction. How can I add a column to the table below that will show the total commission amount by person? For example, "Graham Zusi" would still have two rows, one for each unique transaction. However, there would be a third column where his two transactions are summed up. That way it's possible to see the individual transaction amount as well as the overall commission gained from each customer side by side
Thanks for your help.
cust_name TRANSACTION COMMISSION
Brad Davis 360.0900
Fabian Johnson 277.6802
Jozy Altidor 9.7877
Graham Zusi 19.5650
Graham Zusi 123.3050
Julian Green 32.5585
I've tried using GroupBy and Sum but I can't seem to get it.
SELECT c.CUST_NAME,(s.COMMISSION*o.PURCH_AMT)AS "TRANSACTION COMMISSION"
FROM SALESMAN s, CUSTOMER c, ORDERS o
WHERE
o.SALESMAN_ID=s.SALESMAN_ID
AND
o.CUSTOMER_ID=c.CUSTOMER_ID