# ORDER BY in JQL: syntax and examples

URL: https://goingstellar.ro/reference/jql/order-by/

ORDER BY decides the order of the results. List one field or several, each with its own direction, at the very end of the query. Without a direction, the field's own default order is used.

## Syntax

```
... ORDER BY field [ASC | DESC]
... ORDER BY field1 [ASC | DESC], field2 [ASC | DESC]
```

## Arguments

- `field` (optional: yes): The field to sort by. Separate several fields with commas.
- `ASC or DESC` (optional: no): Ascending or descending. Each field takes its own.

## Works with

- Fields: most fields, including Priority, Created, Updated, Due date, Status, Assignee, Key, Rank
- Placement: the last part of the query, after every condition
- Not with: Comment, Text, Attachments and Work item link type

## Examples

```
project = WEB AND statusCategory != Done ORDER BY priority DESC, created ASC
```

The work list for a stand-up: most urgent first, and oldest first within each priority. Run on Jira Cloud on 2026-11-29.

```
project = WEB AND statusCategory != Done ORDER BY duedate ASC
```

Deadlines in order, soonest on top. Work with no due date comes last. Run on Jira Cloud on 2026-11-29.

```
project = WEB AND sprint is EMPTY AND statusCategory != Done ORDER BY Rank ASC
```

The unscheduled backlog in the order the team ranked it. Run on Jira Cloud on 2026-11-29.

```
project in (WEB, MOB) ORDER BY project ASC, status ASC, created DESC
```

Three sort keys: grouped by project, then by status, then newest first inside each group. Run on Jira Cloud on 2026-11-29.

```
project = WEB ORDER BY updated DESC, key ASC
```

Latest activity first, with the key as a tie-breaker so items changed together always appear in the same order. Run on Jira Cloud on 2026-11-29.

```
project = WEB AND statusCategory != Done ORDER BY created, priority DESC
```

Each direction belongs to the field before it: created uses its default order and only priority is descending. Run on Jira Cloud on 2026-11-29.

## Pitfalls

- Nothing can follow it except more sort fields. `project = WEB ORDER BY created DESC AND status = Done` fails with "Expecting ',' but got 'AND'.", and a second ORDER BY fails the same way with "Expecting ',' but got 'ORDER'."
- Some fields cannot be sorted. `ORDER BY comment` returns "Field 'comment' does not support sorting.", and the same message appears for text, attachments and issuelinktype. An unknown name gives "Not able to sort using field 'nonexistent'." A direction other than ASC or DESC fails with "Expecting either 'ASC' or 'DESC' but got 'sideways'."
- Empty values go to the far end. With `ORDER BY duedate ASC` the undated work is at the bottom, with DESC it opens the list, so a deadline list sorted descending starts with items that have no deadline (checked on Jira Cloud, November 2026).
- Priority without a direction already lists the highest first, so `ORDER BY priority` and `ORDER BY priority DESC` agree, and ASC reverses it (checked on Jira Cloud, November 2026). Atlassian also notes that sorting by component or version groups by space first and only then by the field.

## Ready-made queries

- [Overdue work items](https://goingstellar.ro/tools/jql-examples/#overdue)
- [Due in the next N days](https://goingstellar.ro/tools/jql-examples/#due-next-n-days)
- [Unassigned open work](https://goingstellar.ro/tools/jql-examples/#unassigned)
- [My open work](https://goingstellar.ro/tools/jql-examples/#my-open)
- [Current sprint](https://goingstellar.ro/tools/jql-examples/#current-sprint)
- [Still open in the current sprint](https://goingstellar.ro/tools/jql-examples/#current-sprint-not-done)
- [Created in the last N days](https://goingstellar.ro/tools/jql-examples/#created-last-n-days)
- [Updated today](https://goingstellar.ro/tools/jql-examples/#updated-today)

## Questions and answers

### Can I sort by more than one field in JQL?

Yes. Separate the fields with commas, and give each its own ASC or DESC. The first field is the main sort and the later ones break ties.

## Related

- [AND](https://goingstellar.ro/reference/jql/and-keyword/)
- [OR](https://goingstellar.ro/reference/jql/or-keyword/)
- [EMPTY](https://goingstellar.ro/reference/jql/empty-keyword/)
- [duedate](https://goingstellar.ro/reference/jql/duedate-field/)
- [status](https://goingstellar.ro/reference/jql/status-field/)
- [assignee](https://goingstellar.ro/reference/jql/assignee-field/)

## Sources

- [JQL keywords (Atlassian Support, Jira Cloud)](https://support.atlassian.com/jira-software-cloud/docs/jql-keywords/)

