Last Value Is Not Last
sales, one row per day so no two rows are peers:
| day | amount |
|---|---|
| 1 | 10 |
| 2 | 20 |
| 3 | 30 |
| 4 | 40 |
SELECT day, amount,
first_value(amount) OVER (ORDER BY day) AS f,
last_value(amount) OVER (ORDER BY day) AS l
FROM sales
ORDER BY day;
Reading down the l column, what are the four values?
Sign in to answer questions and track your progress
Sign In