SQL Language (MOSC)

MOSC Banner

query to find running total of a column

edited Oct 6, 2010 11:30AM in SQL Language (MOSC) 4 commentsAnswered
Query to Find the Running Total . i have a table with two columns date and sales . I want the output in  a seperate column with the sales of one row added to the sales of other row-i.e cumulative of sales on date
Data in the Table  - input format
date                       sales
01/04/10               -13.92
01/05/10                199
01/06/10                339.43
01/07/10                286.52
01/08/10                1210.39
01/09/10                 384.35


Output  Required

date                       sales      Running total
01/04/10               -13.92            -13.92
01/05/10                199               185.08
01/06/10                339.43         524.51
01/07/10                286.52         811.03
01/08/10                1210.39       2021.42
01/09/10                 384.35        2405.77

pl suggest sql query to get the above output

Regards
kavitha

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center