PrevUpHomeNext

order()

For any query q, q.order(...) builds a query whose output is q's output, sorted in a specified order. It's a wrapper for SQL's ORDER BY.

Use ascending orders by default ...

For any query q, you can call q.order(exprn0, exprn1, ...), provided that:

q's value mapper will be visible to each exprni.

q.order(exprn0, exprn1, ...) returns a query with the following characteristics:

... or specify ascending or descending orders

To specify that one of the exprni's is to be in descending order, apply the prefix operator - to it. To specify (redundantly) that it is to be in ascending order, apply the prefix operator +. This works whether Ti is an arithmetic type or not.

order(...).order(...).order(...)...

If we chain order(...)calls together, e.g. q.order(A).order(B).order(C), then pipeline semantics applies as usual. So the final (hence most significant) ordering is by C.

At each stage the order is stable with respect to the previous stages, so it's equivalent to q.order(C, B, A).


PrevUpHomeNext