> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/api/guides/common-concepts/sorting-query-results.md).

# Sorting query results

You can sort the query results on one or more fields. If you have multiple fields to sort on, you must enclose them in an array and set the sorting order by rearranging the array elements. For each sorting field you must specify the order direction:

* Ascending: `asc`.
* Descending: `desc`.

To retrieve a list of assets ordered by their full names in ascending order use the following query:

```graphql
query {
    assets(order: {fullName: asc} ) {
        fullName
    }
}
```

To retrieve a list of assets ordered first by the parent domain name and then by the asset full name use the following query:

```graphql
query {
    assets(order: [ {domain: {name: asc}}, {fullName: desc} ]) {
        domain {
            name
        }
        fullName
    }
}
```

{% hint style="info" %}
If you don't provide any order field, the entities are sorted in ascending order of their IDs.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.collibra.com/api/guides/common-concepts/sorting-query-results.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
