I m using the following query, to get the result as shown below. Actually the query is just joining 2 tables.
SELECT MT.mkt_Area_ID,MA.mkt_Reg_ID,MT.mktcate_id,MT.target_Amt,MT.year
FROM [CRM].[tblMktArea_Target] MT JOIN CRM.tblMarketingArea MA
ON MA.mkt_Area_ID= MT.mkt_Area_ID WHERE month IN (05,04) AND year=2013 AND MA.mkt_Area_ID=1
AND MA.mkt_Reg_ID =1
How can I group the results by mktcate_id to get the sum of target_amt for each category?
I tried:
SELECT MT.mkt_Area_ID,MA.mkt_Reg_ID,MT.mktcate_id,Sum(MT.target_Amt),MT.year
FROM [CRM].[tblMktArea_Target] MT JOIN CRM.tblMarketingArea MA
ON MA.mkt_Area_ID= MT.mkt_Area_ID WHERE month IN (05,04) AND year=2013 AND MA.mkt_Area_ID=1
AND MA.mkt_Reg_ID =1 group by MT.mktcate_id
and getting errror