Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,369,237
Community Members
 
Community Events
168
Community Groups

Order by multiple fields

How do I order by one field, then within that result, order by a second field?

2 answers

1 accepted

17 votes
Answer accepted

Do your search then add as many ORDERS separated by a "," eg. ORDER BY resolution ASC, Assignee DESC.

Thanks. this was very helpful

Like # people like this

Should add for beginners who might look this up you need to switch to JQL.

Like # people like this

Hi! This does not work for the case of:

  • ORDER BY duedate ASC, Rank ASC

as I get the error about ranking

Screenshot from 2021-04-05 14-09-07.png

Has anyone else had the same?

This functionality does not work. The sorting is wrong. I am ordering  by:

ORDER BY due ASC, created ASC 

And as you can see the result is off. The second column is not sorted properly. 

screenshot.1627991358.png

Like Xavier Mulot likes this

Why is the second column not sorted properly? I might miss something but from the screen, the results are sorted first by due ascending - and it looks correct from 06/07 till 17/08. The second column is created - I see that created dates for due=17/08 are sorted in ascending order. What result did you expect to see? 

Like Nic Brough _Adaptavist_ likes this

check the first and last row in second column with values 6/7/2021 and 5/7/2021 value in between. The last row should not have value 6/7/2021.

this doesn't work, order by cf[24135], assignee ASC and it didn't work. I expected to have the first column sorted and then the second but it's the other way around regardless of which field I add first. cf[24135] is the first field before the hyphen, and then the assignee is the one after that. I always get:

 

Tier 1 - Aida - - Legal Review - TBI Bank EAD (BG) <-> Revolut Bank UAB  - Pending Vendor Owner
Tier 1 - Aida - - Legal Review - Aion Bank (BE) <-> Revolut Bank UAB  - 3B. Negotiations in Progress
Material Third Party - Aida -  - Legal Review - Banca del Sud SpA (IT) <-> Revolut Bank UAB  - Pending Vendor Owner
Material Third Party - Aida -  - Legal Review - MeDirect Bank plc (MT) <-> Revolut Bank UAB  - Pending Vendor Owner
Tier 1 - Aida -  - Legal Review - Majorel Wilhelmshaven GmbH (DE) <-> Revolut Bank UAB  - Pending Vendor Owner
Tier 3 - Aida - - Legal Review - Outbrain  (DE) <-> Revolut Bank UAB  - Pending Vendor Owner
Material Third Party - Aida - - Legal Review - BlueOrange Bank (LV) <-> Revolut Bank UAB  - Pending Vendor Owner
Tier 2 - Aida -  - Legal Review - J.P. Morgan Bank Luxembourg S.A. (LU) <-> Revolut Holdings Europe UAB  - Pending Vendor Owner
Tier 2 - alankar-  - Legal Review - Ernst & Young LLP (IN) <-> Revolut Payments India Private Limited  - 3B. Negotiations in Progress
Tier 3 - alankar-  - Legal Review - Blue Dart Express Ltd (IN) <-> Revolut Operations India Private Limited  - Pending Vendor Owner
Material Third Party - alankar- - Legal Review - TSS Consultancy Pvt Ltd (IN) <-> Arvog Forex Private Limited  - Pending Vendor Owner
Non-Material Outsourcing - alankar-  Legal Review - EY (IN) <-> Revolut Ltd  - 3B. Negotiations in Progress
Tier 1 - alankar-  - Legal Review - Hyperverge technologies private limited (IN) <-> Arvog Forex Private Limited  - Pending Vendor Owner
Tier 1 - alankar-  - Legal Review - Price Waterhouse & Co LLP (IN) <-> Arvog Forex Private Limited  - Pending Vendor Owner

 

I would've expected to first get all Tier 1 for all assignees, then all Tier 2 for all assignees and so on. Any clues?

What is being returned if you use a single sorting field of cf[24135]?

and how exactly does your query look like? 

 

I used sorting by custom fields and my values were a specific set, so the sorting was based on their IDs and not the actual values but your query result does seem kinda odd. 

it's odd, whenm I sort only by that field, it doesn't work either. I have exactly the same field in a different project and it does work perfeclty. Any ideas why that particular field in one particular project is not responding? I wouldn't mind having them sorted by IDs but they're not being sorted at all it seems.

idk, maybe there are some settings for a custom field to appear for specific issue types or projects. 

+ I am not sure if you're trying to search results within a single project or multiple 

+ your search results - is it just the name of the jira ticket or do you actually have that value in your custom field?

+ only trying in a single project

+ it's a custom field, a dropdown. The results don't change at all if I sort ASC or DESC or if I don't sort by that field at all.

However, a custom field (different ID) with exactly the same values under dropdown in a different project works exactly as expected.

Hint: If you have a custom field with some texts, then this works only if you sort these entries alphabetically. It seems that otherwhise the order is taken from the indexnumber and not from the string. Strange!

Thanks, but how can you sort alphabetically? 

Suggest an answer

Log in or Sign up to answer