Tabular Operators
sort
Learn how to Sort the rows of the dataset into an order by one or more columns.
Sorts the rows of the dataset into an order by one or more columns.
Syntax
Arguments
name | type | description |
---|---|---|
expression | expression | A scalar expression by which to sort. The value type must be numeric, date, time or string. |
asc | string | Sort by into ascending order, low to high. |
desc | string | Sort by into descending order, high to low. |
Use sort and project together
When you use project
and sort
in the same query, ensure you project the fields that you want to sort on. Similarly, when you use project-away
and sort
in the same query, ensure you don’t remove the fields that you want to sort on.
The above is also true for time fields. For example, to project the field status
and sort on the field _time
, project both fields similarly to the query below: