FIRST_VALUE#

Returns the first value in an ordered set of values.

Syntax#

FIRST_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 arbitrary expression that results in a single value. Other analytic functions are not permitted.

Return types#

Is the same type as scalar_expression.

Examples#

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

See Also#