Newer Version Available
order
Sorts in ascending or descending order on one or more fields.
Syntax
asc or desc specifies whether the results are ordered in ascending (asc) or descending (desc) order. The default order is ascending.
Usage
The order statement isn’t applied to the whole set. The order statement operates on rows individually.
You can use the order statement with ungrouped data. You can also use the order statement to specify order within a group or to sort grouped data by an aggregated value.
Example
q = order q by 'count' desc;
Example
To order a stream by multiple fields, use this
syntax:
Example
You can order a cogrouped stream before a foreach
statement:
Example
You can’t reference a preprojection ID in a postprojection order operation. (Projection is another term for a foreach operation.) This code throws an error:
This
code is
valid: