I'm trying to query the diff between row values, in SQL it would be something like
SELECT timestamp, price - LAG(price) OVER (ORDER BY timestamp) as price_diff
from trades
But QuestDB returns Window function expected error at the position of LAG.
Is there a similar window function in QuestDB that can work instead of LAG?
You can use
first_valuewindow function like to simulate LAG function: