Need a query to find out active and inactive Jira project over the last 6 months.

Rohan Kulkarni December 3, 2013

Need a query to find out active and inactive Jira project over the last 6 months.

4 answers

0 votes
Harish May 13, 2021

i was unable to get the list of inactive projects in jira with the above listed sql query. 

Srinath Reddy Pinappu May 18, 2021

SELECT id, pname, pkey 
FROM project 
WHERE ID IN 
(SELECT DISTINCT(project) 
 FROM jiraissue 
 WHERE updated > sysdate - 180 
 ) 
ORDER BY pname;

Srinath Reddy Pinappu May 18, 2021

SELECT count(id)
FROM project
WHERE ID NOT IN
(SELECT DISTINCT(project)
FROM jiraissue
WHERE updated > sysdate - 180
)
ORDER BY pname;

0 votes
Santhosh Reddy Singireddy September 24, 2018

Can anyone of you provide me MS SQL Command or JQL? I tried the above command but it did not work. 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 24, 2018

JQL is for finding issues, the best you can do is get a list of projects that have been updated in the last X months, which you can then cross off a list of all projects.

Santhosh Reddy Singireddy September 24, 2018

I tried list of JQL's hoping that would be the correct one but can you please provide JQL so that I can make sure I'm on the correct page? I appreciate your comments :) 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 24, 2018

updated > -#d

Replace the # with the number of days back you want to go.

0 votes
Jose Zuniga September 19, 2018

I did it with the last date updated per project with SubFactory

select * from (

select project, updated,

max(updated) over (partition by project) as max_update
from jiraissue
) temp
where updated = max_update

Nirmani Kalakheti
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2020

I need to run against my Oracle db. It works fine but I get project ID instead of Project Name. What would be the query to list the project names (active and inactive projects) in Oracle db.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2013

There isn't an easy way to do this really, and when you say "query", you haven't said whether you want SQL or JQL

As a starter in Jira define two filters - one for "updated in the last 6 months" and a second for "updated more than 6 months ago" (both are for ALL issues). Create a dashboard, and put two gadgets on it, both "filter statistics" and grouped by the field "project", one for each filter. That will give you a feel for the age of projects because ones with a large "updated > 6 months ago" and little or no activity in the other gadget will be "inactive"

I wrote a report to do something like this automatically a while ago. I hope to be able to actually finish it and upgrade it to v6 over Christmas...

Rohan Kulkarni December 3, 2013

Hi Nic,

OOPS I was looking for a MySQL query. Is this query correct?

mysql->SELECT count(id) FROM project WHERE ID NOT IN (SELECT DISTINCT(project) FROM jiraissue WHERE updated > DATE_SUB(NOW(), INTERVAL6 MONTH)) ORDER BY pname;

I need to get the count of active and/or inactive project over last 6 months.

Thanks and Regards,

Rohan

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 3, 2013

That SQL looks right to me, yes.

Rohan Kulkarni December 4, 2013

Nic,

The above query will get the count of Inactive project(issue updated over last 6 months) but there can be a case where in an issue is created within last 6 months but not updated. In this case even this project is an Active one, so I need to check both the conditions i.e. Created and Updated. Hence which of the following query will give me correct result.

1. SELECT count(id) FROM project WHERE ID NOT IN (SELECT DISTINCT(project) FROM jiraissue WHERE updated > DATE_SUB(NOW(), INTERVAL 6 MONTH) and created > DATE_SUB(NOW(), INTERVAL 6 MONTH));

2.SELECT count(id) FROM project WHERE ID NOT IN (SELECT DISTINCT(project) FROM jiraissue WHERE updated > DATE_SUB(NOW(), INTERVAL 6 MONTH) or created > DATE_SUB(NOW(), INTERVAL 6 MONTH));

Note : Both the abobe queries are for Inactive projects and I am confused over "and" and "or" in the query.

Thanks and Regards,

Rohan

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2013

For issues which are created and then not touched, I don't think you need worry - the updated date is set to the same as the created date when they're created. So I don't think you need to worry about the created date.

Hemanth Kumar March 22, 2023

 

@Rohan Kulkarni2 

Date_sub & now is not recognized as build in function, please advise

1. SELECT count(id) FROM project WHERE ID NOT IN (SELECT DISTINCT(project) FROM jiraissue WHERE updated > DATE_SUB(NOW(), INTERVAL 6 MONTH) and created > DATE_SUB(NOW(), INTERVAL 6 MONTH));

2.SELECT count(id) FROM project WHERE ID NOT IN (SELECT DISTINCT(project) FROM jiraissue WHERE updated > DATE_SUB(NOW(), INTERVAL 6 MONTH) or created > DATE_SUB(NOW(), INTERVAL 6 MONTH));

Suggest an answer

Log in or Sign up to answer