• 93
    • 3
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Summary

      When running JQL ORDER BY Desc, JIRA places the issue with null value for that field at the highest order, instead of at the lower order. According to the documentation from PostgreSQL 8.3.23 the NULLS FIRST is the default for DESC order, but is configurable.

      Steps to Reproduce

      1. Having 3 issues with value for a custom field as 1, 2, and null
      2. Run JQL query: ORDER BY <cusom_field> Desc

      Actual Result

      JIRA places the null value at the highest rank
      null
      2
      1

      Suggestion

      JIRA could order the issues as follows:
      2
      1
      null

        1. jql.png
          jql.png
          138 kB

            [JRACLOUD-72847] JQL "ORDER BY Desc" place null at the highest order

            abby.dong added a comment -

            Hoping this is prioritized soon. We create reports and insert Jira issue lists into Confluence pages where we prefer to sort by Due Date (DESC). However, this puts empty Due Dates at the top of the list, and defeats our purpose of showing timely upcoming work. We still need to see the items with empty Due Dates, we just expect them to be listed after anything else that isn't null. 

            abby.dong added a comment - Hoping this is prioritized soon. We create reports and insert Jira issue lists into Confluence pages where we prefer to sort by Due Date (DESC). However, this puts empty Due Dates at the top of the list, and defeats our purpose of showing timely upcoming work. We still need to see the items with empty Due Dates, we just expect them to be listed after anything else that isn't null. 

            Yujin Cho added a comment -

            Please take it!!! 

            Yujin Cho added a comment - Please take it!!! 

            Another use case where this would be helpful. I want to sort by Target Date with cards without Target Date populated displaying below those with Target Date populated. 

            If I sort ASC then the following displays:

            If I sort descending then nulls are last but things are in reverse order then of what I'd like to see:

             

             

            Daniel Loewenstein added a comment - Another use case where this would be helpful. I want to sort by Target Date with cards without Target Date populated displaying below those with Target Date populated.  If I sort ASC then the following displays: If I sort descending then nulls are last but things are in reverse order then of what I'd like to see:    

            Still an issue and needs fixing.

            Guillaume Chomienne added a comment - Still an issue and needs fixing.

            In oracle, you can do any of the following:

            1. ... order by column_a;  (default behavior,  ascending, nulls last by default)
            2. ... order by column_a asc;  (ascending, nulls last by default)
            3. ... order by column_a desc;  (descending, nulls first by default)
            4. ... order by column_a asc nulls first;  (ascending, nulls first)
            5. ... order by column_a desc nulls first;  (descending, nulls first)
            6. ... order by column_a asc nulls last;  (ascending, nulls last)
            7. ... order by column_a desc nulls last;  (descending, nulls last

            Jira should support similar functionality.

            Phillip Brockhaus added a comment - In oracle, you can do any of the following: ... order by column_a;  (default behavior,  ascending, nulls last by default) ... order by column_a asc;  (ascending, nulls last by default) ... order by column_a desc;  (descending, nulls first by default) ... order by column_a asc nulls first;  (ascending, nulls first) ... order by column_a desc nulls first;  (descending, nulls first) ... order by column_a asc nulls last;  (ascending, nulls last) ... order by column_a desc nulls last;  (descending, nulls last Jira should support similar functionality.

            3 years later, this is still "gathering interest"... hang in there people!

            Pablo Esteban Quiroga added a comment - 3 years later, this is still "gathering interest"... hang in there people!

            This issue applies to all situations, where the query results represent some kind of tree structure that is encoded through a collection of fields, like: Level1-Field - Level2-Field - Level3-Field - etc.; due to the issue, higher-level elements (tree roots) are always placed at the bottom of their sub-tree, which is not intended in most situations.

            For an illustrative example see the following issue report, which includes the frequently relevant example of sorting Epics and Tasks (i.e., a two-level tree structure, where due to the issue Tasks (or Stories) are placed above their associated Epics, while you would want it the other way round): https://jira.atlassian.com/browse/JRACLOUD-73564

            It would be very desirable that the handling of NULL in JQL queries could be controlled.

            Andreas Birk added a comment - This issue applies to all situations, where the query results represent some kind of tree structure that is encoded through a collection of fields, like: Level1-Field - Level2-Field - Level3-Field - etc.; due to the issue, higher-level elements (tree roots) are always placed at the bottom of their sub-tree, which is not intended in most situations. For an illustrative example see the following issue report, which includes the frequently relevant example of sorting Epics and Tasks (i.e., a two-level tree structure, where due to the issue Tasks (or Stories) are placed above their associated Epics, while you would want it the other way round): https://jira.atlassian.com/browse/JRACLOUD-73564 It would be very desirable that the handling of NULL in JQL queries could be controlled.

            Gutt Marc added a comment -

            Gutt Marc added a comment - Still waiting for this. It would solve this issue: https://community.atlassian.com/t5/Jira-Core-Server-questions/Order-by-duedate-but-duedate-null-at-the-bottom/qaq-p/1562373

            Is there a disconnect between the Summary/Title and the Description/Request?
            Current behavior is "null at the highest order" vs intended behavior "place null last"?

            Jason Neely added a comment - Is there a disconnect between the Summary/Title and the Description/Request? Current behavior is "null at the highest order" vs intended behavior "place null last"?

            This is feature that would be helpful and is Natural to have if something is called a Query Language.

            KrishnaKant Agrawal added a comment - This is feature that would be helpful and is Natural to have if something is called a Query Language.

              Unassigned Unassigned
              azuhra Aqqiela
              Votes:
              158 Vote for this issue
              Watchers:
              57 Start watching this issue

                Created:
                Updated: