Aggregate. Returns the nth value from a group of values. The first argument determines which value is returned.
nth ( number, expression )
number |
An integer specifying which record in the group to reference. If no group order is specified, the default order is arrival, where 0 would be the most recent record. If group order is specified, then 0 will reference the first record in the group, 1 the next, etc... |
expression |
An expression that references the rows in the group. This will typically include references to one or more columns in the input. Supports any datatype. |
The function returns the same datatype as its expression argument.
When assessing stock portfolios, use the nth function to identify a specific item in a list. For example, you can identify the day's third-highest traded stock price indicated by the third item in the index. The nth function's uses a 0-based index.