I'm stuck with a scenario where i have to create a dynamic variable for a select query which hold the data of a particular filed. Here is the scenario
Table 'Customer' has below data
Column0 Column1 Column2 Column3 Column4 Column5
--------------------------------------------------------
H 123X 11/27/2017 C 10.23
D 123X 78462F103 11/28/2017 A 112.35
D 123X 55024U109 11/28/2017 A 25.30
H 456X 11/27/2017 B 5263.44
D 456X 78462F103 11/28/2017 A 23.00
D 456X 55024U109 11/28/2017 A 12123.00
D 456X 78462F103 11/28/2017 A 56.08
D 456X 55024U109 11/28/2017 C 45.07
Now i have to create variable when Column0='H'
using the Sum(column5)
and load it into Column5
when Column0='D'
until the Column0='H'
value changes(Table has multiple H values).
Example: I have to calculate the variable when Column0='H' lets say If Column0='H' then Variable=Sum(Column5) which is '5.36'. Now When Coulmn1='D' then Column5's value shlould be loaded as 5.63 when the When the new Column0='H' comes the value of variable changes to '6.33' and it should load the updated value into 'D' records.
Any suggestions on this?