In SQL Server, FIRST_VALUE()
is a window function that returns the first value in an ordered set of values.
Basically, we can use it to get a value from the first row of a query result set or partition. This can be handy if we want to compare a value in the current row with a value in the first row, or use it as part of a calculation.
Continue reading