SQL to return for every project most recent updated date

We are hosting > 100 projects in our JIRA instance. I'd like to know if all of these projects are active.

Current idea is to run a query that returns the most recent update date or create date for any issue, one for each project.  So it doesn't matter which issue within the project it is.  I just want to know when the last activity was.

Hope this makes sense. If you have a better way to gather this information would love to hear it.

If it makes a difference, we're running postgresql.

Thanks.

2 answers

1 accepted

1 vote
Accepted answer
Rodrigo Rosa Atlassian Team Sep 03, 2015

Hello team,

Please try the query from this previous answer:

https://answers.atlassian.com/questions/176459

I've adapted it to postgres:

SELECT DISTINCT i.PROJECT, MIN(i.UPDATED) as "Last Updated", p.pname
FROM jiraissue i
INNER JOIN project p
ON p.ID = i.PROJECT
GROUP BY i.PROJECT, p.pname
ORDER BY MIN(i.UPDATED) ASC, i.PROJECT, p.pname

That is Brilliant!!! Thank you so much.

I spoke too soon. :( the results indicated for project ABC that the last update was on 2012-10-16. But when I search on issues for that project, I see updates as recent as 8 days ago. I'll play around with it. I see where you are going here.

Okay, changed MIN to MAX and it's a thing of beauty! SELECT DISTINCT i.PROJECT, MAX(i.UPDATED) as "Last Updated", p.pname FROM jiraissue i INNER JOIN project p ON p.ID = i.PROJECT GROUP BY i.PROJECT, p.pname ORDER BY MAX(i.UPDATED) ASC, i.PROJECT, p.pname;

Like 1 person likes this

Question ... know what the query would be for confluence and stash??????

Hi,

do you know how i can get it to list the project keys instead of the project names? or to list both the project keys and names?

The Query is working nice! But has a little issue, for nulls values on the "Last issue update" are not listed.


DI2E SysAdmin was right max and min needs to be switched for this query to work correctly. Thanks all!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

45 views 0 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you