Aggregates
Aggregate
lag()
Reference: DuckDB 1.5.5
Arguments & returns
lag(col0, col1, col2)
Aggregate
| Overload link | col0 | col1 | col2 |
Returns |
|---|---|---|---|---|
| #01 | T | BIGINT | T |
T |
Example
1 more ↓Haybarn WASM 2.0.0-rc12 · In your browser
Engine example with sample data · Run to view results.
More examples
Haybarn WASM 2.0.0-rc12 · In your browser
Guide example · Run to view results.
In other engines
ClickHouselag()
SELECT lag(salary, 1, 0) OVER (ORDER BY hire_date) AS prev_sal FROM employees
SELECT LAG(salary, 1, 0) OVER (ORDER BY hire_date) AS prev_sal FROM employees