I have a t
variable which contains 100 and one table .
that table name credit
and it contains the following data
Id
1
2
3
I would like the result set to look like this:
result
99 (100 - 1)
97 (100 - 2 - 1)
94 (100 - 3 - 2 - 1)
So far, I have been able to use the following code successfully:
set @t=100;
select @t:=@t-id as result from credit;
Is there a way to do this without using a variable?