Sort List Queries
Results from your query can be sorted by using the sort argument. The sort order (ascending vs. descending) gets set by specifying ASC or DESC for the field name.
In the following examples, we have a table called students, which contains fields and relations like createdAt, firstName, email.
Using Sorting in Queries
Section titled “Using Sorting in Queries”Here is a query where the results will be sorted in ascending order of creation date.
Request
query MyQuery1 { students(sort: [CREATEDAT]) { items { id createdAt firstName email } }}Response
{ "data": { "students": { "items": [ { "id": "287cff0a-345b-4cca-9e9a-75a2161238fd", "createdAt": "2025-12-02T05:01:31.054581Z", "firstName": "James", "email": "james.smith@example.com" }, { "id": "97fb89ac-e0ad-44f5-b671-24a1b751287c", "createdAt": "2025-12-02T05:03:17.180675Z", "firstName": "John", "email": "john.williams@example.com" }, { "id": "429cf99f-4481-49c4-adb4-605731b20eb2", "createdAt": "2025-12-04T14:16:53.049955Z", "firstName": "Mary", "email": "mary.brown@example.com" } ] } }}Nested and Multi-field Sorting
Section titled “Nested and Multi-field Sorting”Results from your query can be sorted by attributes on related tables, as well as using multiple sort objects. They’re ranked in priority by the order they are recieved in.
Request
Response