How to order issues with null first or null last?

Rodrigo Carvalho de Martinez August 26, 2015

Greetings

Is there a way to specify null values to be ordered first or last in an ORDER BY clause in JQL?

I'm ordering by a custom field and null values are first by default it seems...

JIRA 6.4 (web version)

 

Cheers

3 answers

2 votes
Chloe April 5, 2021

It's frastrating to have this unfriendly sorting problem.

Please vote and watch the following issues if you have the same problem.

https://jira.atlassian.com/browse/JRACLOUD-72847

https://jira.atlassian.com/browse/JRASERVER-65848

1 vote
Simon Hedges October 20, 2020

This would be a useful feature.  I want to order values for Sprint 1 first, followed by Sprint 2 and so on.  So I want to order by Sprints in ascending order.  But I also want to show issues not in any Sprint - but at the bottom.  Jira seems unable to do this because there seems to be no JQL equivalent of the "nulls last" option in SQL.

0 votes
Guilherme Nogueira
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2015

JIRA returns null as first result because in meaning of comparison, null is lower than any another value.

I don't know if you want to order all null columns or only one.

If you are going to order only one, you can use null checkers like:

E.g.

reporter = abc and customfield_1 is not empty order by customfield_1 desc
Simon Hedges October 20, 2020

This doesn't seem to order the nulls (empties), but rather excludes them.  

Like # people like this

Suggest an answer

Log in or Sign up to answer