# Ordering and Sorting Data

To sort accounts data we need to apply <mark style="color:yellow;">**order\_by**</mark> command on data fields of our choice.

For example to fetch **all** **spl-governance proposalsV2** where governing mint is **Grape token** sorted by **drafting date**. For this we can apply order **order\_by** on **draftAt.**

{% hint style="info" %}
Use our [GraphQL demo project](https://github.com/Shyft-to/community-projects/tree/main/graphql-demo) to try out these queries in code.
{% endhint %}

The resulting query looks like

<mark style="color:yellow;">**ProposalsV2 where governing mint is Grape token sorted by drafting date**</mark>

```graphql
query MyQuery {
  GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw_ProposalV2(
    where: {governingTokenMint: {_eq: "8upjSpvjcdpuzhfR1zriwg5NXkwDruejqNE9WNbPRtyA"}}
    order_by: {draftAt: desc}
  ) {
    name
    pubkey
    draftAt
  }
}
```

<figure><img src="/files/IIOp6x6jXcCdUe8DeYEk" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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://docs.shyft.to/solana-indexers/graphql-apis/ordering-and-sorting-data.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.
