English | 简体中文

api-docs / org.ktorm.dsl / lag

lag

fun <T : Any> lag(
    expr: ColumnDeclaring<T>,
    offset: Int = 1,
    defVal: T? = null
): WindowFunctionExpression<T>
(source code)

fun <T : Any> lag(
    expr: ColumnDeclaring<T>,
    offset: Int,
    defVal: ColumnDeclaring<T>
): WindowFunctionExpression<T>
(source code)

The lag window function, translated to lag(expr, offset[, defVal]) in SQL.

Return the value of expr from the row that lags (precedes) the current row by offset rows within its partition.
If there is no such row, the return value is defVal. For example, if offset is 3, the return value is default
for the first three rows.

Since
3.6.0