Was this helpful?
Was this helpful?
The FIRST_VALUE
function returns the value from the first row in a window.
The default behavior is RESPECT NULLS
. If the IGNORE NULLS
option is specified, the function returns the first non-null row in each window (assuming one exists, null
otherwise).
This example computes the number of games played by a player in their first year.
Output:
p1
2000
10
p1
2001
15
p1
2002
12
p2
1990
120
p2
1991
124
p3
2006
30
p3
2007
25
p3
2009
20
p3
2010
15
This section contains reference documentation for the FIRST_VALUE window function.