By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
@@VERSION |
---|
8.0.27 |
company | quote | LAG(quote) OVER(PARTITION BY company ORDER BY t) |
---|---|---|
G | 40 | null |
G | 60 | 40 |
S | 60 | null |
S | 20 | 60 |
company | quote - LAG(quote) OVER(PARTITION BY company ORDER BY t) |
---|---|
G | null |
G | 20 |
S | null |
S | -40 |