Skip to content

orderby / sortby / order by / sort by - Order a set of results

The orderby command will sort the data by ascending/descending order of some expression value.

Ordering by multiple expressions is supported.

NOTE: orderby supports many aliases. Be mindful about consistency across queries.

Syntax

(orderby|sortby|order by|sort by) <expression> [(asc|desc)] , ...

Size limitation

The DataPrime query engine supports sorting up to 10,000 values. After this number, sorting is not guaranteed.

Example - Basic usage

Sorting any set by a given field is the most simple method for ordering.

filter user != null
| orderby user 

This will sort the results in alphabetical order, according to the name of the user.

Example - Sorting by a numeric value

When sorting by a number type, it's important to ensure that you explicitly cast to number, to avoid lexographic sorting errors.

orderby my_num_field:number desc