Skip to main content
Skip table of contents

NQL sort

A sort ... asc or sort ... desc clause orders the results by a field in ascending or descending order, respectively.

Syntax

Sort data starting from the lowest value:

CODE
....
| sort <field name> asc

Sort data starting from the highest value:

CODE
....
| sort <field name> desc

Examples

Sort users by their username in alphabetical order:

CODE
users during past 7d
| list username, type
| sort username asc

Name

Type

Alice Smith

LOCAL_USER

Amanda Carella

LOCAL_ADMIN

Sort users by their username in reverse alphabetical order:

CODE
users during past 7d
| list username, type
| sort username desc

Name

Type

Zion Bush

LOCAL_USER

Zachary Doe

LOCAL_ADMIN

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.