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

# ORDER BY

> Sort the results by one or more columns.

`ORDER BY` sorts the results. Name a column and a direction: `DESC` for largest first, `ASC` for smallest first. Leave the direction out and it's `ASC`.

```sql theme={null}
FROM sales
  SHOW net_sales, orders
  GROUP BY product_vendor
  ORDER BY net_sales DESC
```

Sort by more than one column to break ties:

```sql theme={null}
FROM sales
  SHOW net_sales, orders
  GROUP BY product_vendor
  ORDER BY orders DESC, net_sales DESC
```

Sorting decides which rows [LIMIT](https://docs.queryful.app/queryfulql/syntax/limit.md) keeps. On the report page, clicking a column heading changes the sort.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.