I have column COMPONENT_AMOUNT(money)
,MONTH_FOR(int)
, YEAR_FOR(int)
and COMPONENT_TYPE(int)
. I want to find the sum of amount according to condition. I have written my query like this but it solve my purpose.
My purpose is that if one select Nov-2010 then it will sum the amount up to this selected month including all the month of 2009.
My query is given below ,please modify it:
SELECT SUM(Convert(Numeric(7,2), Round([COMPONENT_AMOUNT],2,1)))
FROM [TEAM_FUNDS_DETAILS]
WHERE YEAR_FOR <= 1 AND MONTH_FOR <= 1 AND [COMPONENT_TYPE] = 1