Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How can I get the cumulative sum of a field in a table

$
0
0

For Eg.

 

I have a table like gias given below:

Name                  Amount

------------------------------

aaa                       10

bbb                      20

 

and I want an output like one given below on running SQL query or stored procedure

Name                  Amount                  cumulative amount

---------------------------------------------------------------------

aaa                       10                              10

bbb                      20                              30

 

can anyone plz help me on this

 


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>