> For the complete documentation index, see [llms.txt](https://docs.shyft.to/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shyft.to/solana-indexers/graphql-apis/ordering-and-sorting-data.md).

# 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>
