DECLARE @TempData as TABLE
(
Name nvarchar(1111),
MonthName nvarchar(1000),
CountName int
)
INSERT INTO @TempData
VALUES ('Class 1', 'September 2013', 1),
('Class 2', 'October 2013', 4),
('Class 2', 'November 2013', 4),
('Class 3', 'December 2013', 6),
('Class 1', 'January 2014', 2)
SELECT * FROM @TempData
Name MonthName CountName
Class 1 September 2013 1
Class 2 October 2013 4
Class 2 November 2013 4
Class 3 December 2013 6
Class 1 January 2014 2
I would like a year to date, so September CountName will remain 1 but OCtober will be Sep + October values ie 4+1 = 6 and so on...
Name MonthName CountName
Class 1 September 2013 1
Class 2 October 2013 5
Class 2 November 2013 9
Class 3 December 2013 15
Class 1 January 2014 2