JIRA JQL ORDER BY Case Statement Search

50 Views Asked by At

I have a list of issues in JIRA and wish include issues with ranks >= 0, but I want to view all the issues with rank 1, 2, 3, ... first and then all the 0 ranked issues.

How am I able to accomplish this?

In T-SQL, you can something like: ORDER BY CASE WHEN [FIELD] = [COMPARISON] THEN 1 ELSE 0 END DESC

but am unable to accomplish this in JQL. Any help is appreciated.

This is the query I tried using but am getting an error message.

jql query

1

There are 1 best solutions below

0
Mohamed Yedes On

This is an example of JQL that shows the list of issues that have a story points >= 0 and shows the the issues (with story points = 0) at the end.

"story points" is a custom field.

"Story Points" >= 0 ORDER BY "Story Points" DESC

In your case, you can replace "story points" by your custom field "ranks". So it should be like that.

"ranks" >= 0 ORDER BY "Story Points" DESC