Returns the first N records grouped by the specified columns.

Syntax

| top NumberOfRows by Expression [asc | desc]

Arguments

nametypedescription
Number Of RowsintegerThe number of rows of dataset to return. You can specify any numeric expression.
ExpressionstringA scalar expression by which to sort. The type of the values must be numeric, date, time, or string.
asc or descvalue(the default) may appear to control whether selection is actually from the “bottom” or “top” of the range.

Where:

  • asc: ascending.
  • desc: descending.

Example

['http-logs']
| top 5 by content_type desc

Run in Playground