-2

Actual table:

 ID Oc_date    marks
  1 25-Jul-15   10
  2 26-Jul-15   10
  3 27-Jul-15   10
  4 28-Jul-15   10
  5 29-Jul-15   10

Required result:

  1 25-Jul-15   10
  2 26-Jul-15   20
  3 27-Jul-15   30
  4 28-Jul-15   40
  5 29-Jul-15   50

Need a simple query to get this output.

Paul
  • 26,170
  • 12
  • 85
  • 119

1 Answers1

0

I think below SQL useful to you.

set @csum := 0;
select ID,  Oc_date, marks, (@csum := @csum + marks) as cumulative_sum
from YourTable
order by id;

Thank you.

Venkatesh Panabaka
  • 2,064
  • 4
  • 19
  • 27