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

How to use a value previously stored in a variable?

$
0
0

Hi,

Can you pls advice how to achieve the below kind of scenario in T-SQL ?

--------

Initial_Value

Used_Value

Balance

20

0

20

1

19 (=20-1)

1

18 (=19-1)

2

16 (=18-2)

As every time it calculates the "Balance" part which is my final output it should subtract the "Used_Value" from the previous calculated "Balance"

How can I achieve this (to include it in my stored proc to calculate "Balance" part)

Thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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