order_by
Aliases: orderby (deprecated).
order_by([columnname: col storable, [descending: const bool]?]+) -> ordering
order_by([order_by(...)]+) -> ordering
Combines one or more column orderings into a single ordering value for verbs and ordered aggregates.
You may list order_by(column, true|false) pairs (optional boolean defaults to ascending), or pass nested ordering expressions such as asc, desc, nullsfirst, and nullslast. Use the result where an ordering parameter is required—for example on align, timechart, merge_events, inside ordered aggregates like string_agg, or with sort.
Domain
This is a scalar function (calculates a single output value for a single input row).
Categories
Examples
align 1m, frame(back: 5m), order_by(desc(timestamp)), last:last_not_null(message)
Uses order_by with nested desc so align picks the last non-null message by time within each window.
Updated 18 days ago