# Order Aggregate Results

| AVAILABLE API VERSION |
| --------------------- |
| API v59.0 and later   |

Use the `orderBy` argument to sort the aggregate results alphabetically in either ascending or descending order. You can also specify if null values appear first in the result set.

When querying a [`RecordAggregate`](/docs/platform/graphql/guide/aggregate.md#recordaggregate-type), you can pass in an aggregate function and a `orderBy` argument. If you don't need aggregation, use the [`RecordQuery` type](/docs/platform/graphql/guide/query-record-objects.md) instead.

The `orderBy` argument behaves like the [SOQL `ORDER BY` clause](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_orderby.htm).

:::note
To use the `orderBy` argument, your field must be grouped or aggregated.
:::

All sObjects in the schema have a corresponding order type. The order type combines the API name with the `_OrderBy`. For example, under the `RecordQueryAggregate` fields, `Account` has a corresponding `Account_OrderBy` type. See [Aggregate Schema](/docs/platform/graphql/guide/aggregate-schema.md).

The following field types support ordering. Each field type corresponds to an `AggregateOrderByClause` type. See [Order By Schema](/docs/platform/graphql/guide/aggregate-orderby-schema.md).

- Int
- String
- Boolean
- Id
- DateTime
- Time
- Date
- TextArea
- LongTextArea
- PhoneNumber
- Email
- Url
- Currency
- Geolocation
- Longitude
- Latitude
- Picklist
- Long
- Double
- Percent
- Base64
