ORDER BY Clause
Overview
The ORDER BY
clause sorts query results in either ascending (ASC
) or
descending (DESC
) order. The default sorting order is ascending.
ORDER BY
clause must be appeared in the WITH
or RETURN
clause.
Syntax
ORDER BY expression [ASC | DESC]
[, expression...]
Examples
Sort by property:
MATCH (p:Person)
RETURN p.name, p.age
ORDER BY p.age DESC
Multi-column sorting:
MATCH (c:City)
RETURN c.name, c.population
ORDER BY c.population DESC, c.name ASC
Last updated on