create table foo (a int, b float);
insert into foo values (1, 2), (2,3),(3,2.5),(4,1.5);
a | b
---+-----
1 | 2
2 | 3
3 | 2.5
4 | 1.5
I want to calculate the difference of each b for any a
select RECURSIVE diff (?,?) on b where a=1
OUTPUT:
a | diff
---+-----
1 | 0
2 | 1
3 | .5
4 | -.5
Is it possible to recursively apply a function over all of the table rows?
ain the expected output when you usewhere a = 1in the SQL query?