I was trying to calculate the cumulative sum of a column in SQL Server 2008 R2 after sorting the column in ascending order. I cannot use rows unbounded preceding
or following as it is only available for SQL Server 2012 and beyond. I used the following code :
select
sub_code,
Roll_no,
Total_marks,
sum (Total_marks) over (order by Total_marks ASC) as cumulative_Total
from table
But I get an error:
Incorrect syntax near 'order'
How to resolve this?