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

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;

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

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,967 views 12 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot