Comment Comment by qwertox What is your problem with this example, doesn't it get the job done? WITH temperatures AS ( /* ... */ ) SELECT *, MAX(c) OVER ( ORDER BY t ROWS BETWEEN 2 PRECEDING AND CURRENT ROW ) AS hottest_temperature_last_three_days FROM temperatures; t │ c │ hottest_temperature_last_three_days ────────────┼────┼───────────────────────────────────── 2021-01-01 │ 10 │ 10 2021-01-02 │ 12 │ 12 2021-01-03 │ 13 │ 13 2021-01-04 │ 14 │ 14 2021-01-05 │ 18 │ 18 2021-01-06 │ 15 │ 18 2021-01-07 │ 16 │ 18 2021-01-08 │ 17 │ 17 Why should I fetch all the data and then form the result with another tool?What a great article. parent qwertox 5 years ago
What a great article.