Aggregates
Aggregate
nth_value()
Arguments & returns
nth_value(col0, col1)
Aggregate
| Overload link | col0 | col1 |
Returns |
|---|---|---|---|
| #01 | T | BIGINT |
T |
In other engines
Oraclenth_value()
SELECT NTH_VALUE(x, 2) FROM LAST OVER (ORDER BY y) AS c FROM t
SELECT NTH_VALUE(x, 2) OVER (ORDER BY y) AS c FROM t
Snowflakenth_value()
SELECT NTH_VALUE(is_deleted, 2) OVER (PARTITION BY id) AS nth_is_deleted FROM my_table
SELECT NTH_VALUE(is_deleted, 2) OVER (PARTITION BY id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS nth_is_deleted FROM my_table