desc

Description

Specify the ordering as descending when processing data.

This is used by ordered windowing functions (like lag and last), ordered aggregation functions (like array_agg) and the sort verb.

Return type

ordering

Domain

This is a scalar function (calculates a single output value for a single input row.)

Categories

Usage

desc(columnname)

Argument

Type

Optional

Repeatable

Restrictions

columnname

ordering

no

no

none

Examples

sort desc(foo)

Sort the dataset in descending order by values in column foo.

statsby list:array_agg(username, desc(timestamp)), group_by(hostname)

Lists all users for each host, in order of descending timestamp within each host assuming you have a table with columns timestamp, hostname and username.