Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

cumulative total for row

DewangNov 4 2015 — edited Nov 5 2015

Hi ,

create table test(id varchar2(10),

              a number,

              b number ,

              c number );

             

insert into test (ID, A, B, C)

values ('row1', 0, 100, 20);

insert into test (ID, A, B, C)

values ('row2', 100, 200, 50);

insert into test (ID, A, B, C)

values ('total', 100, 100, 30);

insert into test (ID)

values ('cumulative');

update test

set (a,b,c)=(

select a+b+c ,b+c,c from test

where id= 'total')

where  id= 'cumulative'

I need help whether I can rewrite the update statement for row 'cumulative' in my  table in some another way, as I have many columns in original table

logic for cumulative row is  , it is running total in a row.

Thanks

This post has been answered by Paulzip on Nov 4 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 3 2015
Added on Nov 4 2015
9 comments
622 views