LAST_VALUE#

Returns the last value in an ordered set of values.

Syntax#

LAST_VALUE ( [scalar_expression )
    OVER ( [ partition_by_clause ] order_by_clause rows_range_clause )

Arguments#

scalar_expression

Is the value to be returned. scalar_expression can be a column, subquery, or another expression that results in a single value. Other analytic functions are not permitted.

Return types#

Is the same type as scalar_expression.

Examples#

SELECT LAST_VALUE(IntColumn) OVER(ORDER BY [IntColumn]) AS [ReturnValueFirstValue]
  FROM [IntTable]

See Also#