Skip to main content

first_value

Function first_value 

Source
pub fn first_value<'a, V, E>(
    expr: E,
) -> WindowFnExpr<'a, V, E::SQLType, Null, E::Sources>
where V: SQLParam + 'a, E: Expr<'a, V>,
Expand description

The value of expr in the first row of the frame (FIRST_VALUE(expr)).

The result has expr’s SQL type and is typed as nullable.

§Examples

let n = first_value(users.name).over(window().order_by(asc(users.age)));
assert_eq!(n.sql(), r#"FIRST_VALUE ("users"."name") OVER (ORDER BY "users"."age" ASC)"#);