Returns the largest number_of_values in the value_expression for each group, with or without ties. TOP is a single-threaded function.
To invoke the time series version of this function, use the GROUP BY TIME clause. For more information, see GROUP BY TIME Clause.
- Teradata Database integer value representing the number of values to return.
- A literal or column expression from which the top values are taken.
The value_expression cannot be a reference to a view column derived from a function, and cannot contain any ordered analytical or aggregate functions.
The return value is the same as the input data type.
Nulls are not included in the computation.
TOP is valid only for numeric data.
WITH TIES implies the rows returned by the query include the specified number of rows in the ordered set for each time bucket, plus any additional rows where the sort key value is the same as the value of the sort key in the last row satisfying the specified number or percentage of rows. If this clause is omitted and ties are found, the earliest value in terms of timecode is returned.