How to Identify Issues that belongs to any Sprint in Jira Data Center
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
The purpose of this article is to show how to identify issues with Sprint and those that does not belong to any Sprint. This can be done via JQL and SQL.
Queries were created for PostgreSQL and they may require syntax adjustments for other DB products.
Solution
All the issues that have been put into some sprint:
JQL:
Sprint is not EMPTY
SQL:
select ji.id, concat(P.pkey,concat('-',ji.issuenum)) from jiraissue ji join project P on P.id = ji.project join customfieldvalue cv on ji.id=cv.issue join customfield cf on cf.id=cv.customfield where cf.cfname='Sprint'
All the issues that have not been put into any sprint:
JQL:
Sprint is EMPTY
SQL:
select I.id,concat(P.pkey,concat('-',I.issuenum)) from jiraissue I join project P on P.id = I.project where I.id not in (select ji.id from jiraissue ji join customfieldvalue cv on ji.id=cv.issue join customfield cf on cf.id=cv.customfield where cf.cfname='Sprint')
- Issues that belong to a specific sprint:
JQL (if you provide the name here it will return issues for all sprints with the same name):
Sprint = 'my sprint name'
- SQL query to list the Jira issues associated to the "my sprint name" sprint:
select ji.id, concat(P.pkey,concat('-',ji.issuenum)) as issuekey, ads."NAME", ads."ID" from jiraissue ji join project P on P.id = ji.project join customfieldvalue cv on ji.id=cv.issue join customfield cf on cf.id=cv.customfield join "AO_60DB71_SPRINT" ads on cv.stringvalue=cast(ads."ID" as text) where cf.cfname='Sprint' and ads."NAME" = 'my sprint name' order by issuekey;