> ## Documentation Index
> Fetch the complete documentation index at: https://docs.falkordb.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> FalkorDB is a graph database that speaks the Redis protocol. Queries are issued as OpenCypher through the GRAPH.QUERY and GRAPH.RO_QUERY commands, not over Bolt or a SQL connection.
> FalkorDB implements a subset of OpenCypher with proprietary extensions. Do not assume Neo4j-only syntax or procedures are available — check /cypher/cypher-support and /cypher/known-limitations before using a clause.
> FalkorDB is the successor to RedisGraph, but they are separate products. Do not present RedisGraph commands, versions, or limitations as current FalkorDB behavior.
> Use the official clients listed in /getting-started/clients rather than generic Redis or Neo4j drivers, and prefer the language the user is already working in.
> Configuration parameters are set with GRAPH.CONFIG SET or at startup; cite the exact parameter name from /getting-started/configuration rather than inventing one.
> This site covers four products: FalkorDB (core), FalkorDB Cloud, FalkorDB Enterprise, and the GraphRAG SDK. Name which one an answer applies to, since setup and operations differ.

# ORDER BY

> Sort query results in FalkorDB with the Cypher ORDER BY clause, ordering by one or more properties in ascending or descending order.

Order by specifies that the output be sorted and how.

You can order by multiple properties by stating each variable in the ORDER BY clause.

Each property may specify its sort order with `ASC`/`ASCENDING` or `DESC`/`DESCENDING`. If no order is specified, it defaults to ascending.

The result will be sorted by the first variable listed.

For equal values, it will go to the next property in the ORDER BY clause, and so on.

```sh theme={null}
ORDER BY <alias.property [ASC/DESC] list>
```

Below we sort our friends by height. For equal heights, weight is used to break ties.

```sh theme={null}
ORDER BY friend.height, friend.weight DESC
```

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What is the default sort order in ORDER BY?">
    If no direction is specified, ORDER BY defaults to **ascending** (ASC) order.
  </Accordion>

  <Accordion title="Can I sort by multiple properties?">
    Yes. List multiple properties separated by commas. The result is sorted by the first property, then ties are broken by subsequent properties in order.
  </Accordion>

  <Accordion title="Does ORDER BY work with expressions and aliases?">
    Yes. You can order by any expression or alias that appears in the RETURN or WITH clause, including computed values and aggregations.
  </Accordion>
</AccordionGroup>
