Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Update current row from the results from previous row - forum topic by Prakash4smiling@gmail.com

$
0
0

can someone help me to solve this problem with teradata update query?
Before Update:
Tablename : TEST_SCENARIO
 

Seq_No

NUMBER

SUM_FROM_PREV_REC

1

5

1

 

 

 

2

8

 

 

 

 

3

33

 

 

 

 

4

22

 

 

 

 

5

45

 

 

 

 

6

23

 

 

 

 

7

10

 

 
 
After update:
Tablename : TEST_SCENARIO
 

Seq_No

NUMBER

SUM_FROM_PREV_REC

 

Math ( previous row SUM_FROM_PREV_REC + previous row NUMBER)

1

5

1

 

 

 

 

 

 

 

2

8

6

 

1+5

 

 

 

 

 

3

33

14

 

6+8

 

 

 

 

 

4

22

47

 

14+33

 

 

 

 

 

5

45

69

 

47+22

 

 

 

 

 

6

23

114

 

69+45

 

 

 

 

 

7

10

137

 

114+23

Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



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