I am trying to add together total commissions based on ID's, however it is resulting in separate commission amounts. I need to pull data based on the last year
SELECT
fld.fa_id
,sum(commission_amt) as 'Commission Amount'
,date_id
FROM [dbo].[fa_dim] fa, [dbo].[product_summary] fld
WHERE fa.fa_id = fld.fa_id
AND fld.date_id > 20170523
GROUP BY fld.fa_id , fld.commission_amt , date_id
ORDER BY fld.fa_id
the results I'm getting look like this:
ID Commission
7 50
7 12
7 5
8 20
8 10
I need them to look like this:
ID Commission
7 67
8 30