Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

SQL Query to list projects having a specific issue type

Parashar Joshi
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.
March 28, 2019

Hi All,

Greetings!

I have been looking to find an SQL that can provide the list of all projects which list all the projects using a specific issue type.

I found this thread List of project using a particular issue type.

However, the issue is that it does not list the projects that use the "Default Issue type Scheme" as i see no entries for them in the "OPTIONCONFIGURATION" table.

Can anyone help on this issue?

Thanks,
P

1 answer

1 vote
korney yakovenko
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 28, 2019

Hi, Joshi

 

This query will return all projects that use the specified issue type.

select IT.id issue_id, IT.pname issuetype, PROJ.pname project_name,CC.customfield
from configurationcontext CC
join optionconfiguration OC on OC.fieldconfig = CC.fieldconfigscheme
join issuetype IT on IT.id = OC.optionid
join project PROJ on PROJ.id = CC.project
where lower(IT.pname) like '%epic%' --specify the issue type you want
order by IT.pname;
Parashar Joshi
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.
March 28, 2019

Thank you very much for the answer and first response.

What i noticed was that this query returns fewer projects than the other query.
We are expecting about 800+ projects where my query returns 500+ projects and your's returns about 300.

So something is missed and yet to look at DB design for it.
we are also working with support and searching atlassian KB to get any info.

Parashar Joshi
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.
March 28, 2019

My original query is

SELECT DISTINCT P.PKEY as proj_key
FROM JIRA.PROJECT P JOIN JIRA.CONFIGURATIONCONTEXT CC ON P.ID = CC.PROJECT
JOIN JIRA.FIELDCONFIGSCHEME FCS ON FCS.ID = CC.FIELDCONFIGSCHEME
JOIN JIRA.FIELDCONFIGSCHEMEISSUETYPE FCI ON FCI.FIELDCONFIGSCHEME = CC.FIELDCONFIGSCHEME
JOIN JIRA.OPTIONCONFIGURATION OC ON OC.FIELDCONFIG = FCI.FIELDCONFIGURATION
JOIN JIRA.ISSUETYPE IT ON IT.ID = OC.OPTIONID
where (IT.PNAME = 'XYZ' or IT.PNAME = 'ABC')
order by proj_key;

korney yakovenko
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 29, 2019

Yes, inded. I can offer you a request that will return all projects of the specified type, but only under the condition that there is at least one task according to your type.

 

select distinct ji.project project_id,

pr.pname project_name,

it.pname issue_type

from jiraissue ji
join issuetype it on it.id=ji.issuetype
join project pr on pr.id=ji.project
where it.pname='Epic';
Parashar Joshi
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.
April 1, 2019

Thank you again.

But we have to list all projects even when there are no issues for that issue type for a given project.

-P

Like Aimee Swift likes this

Suggest an answer

Log in or Sign up to answer