Required query user who has created last issue in his project with date and time

Hi ,

Is there any query for getting last created issue in his project ?i need this information for all projects.

4 answers

Here the query for last reporter per project.

SELECT i.created last_create_date, p.pname, i.reporter
FROM  project p, jiraissue i,
(SELECT max(pkey) maxpkey, project FROM jiraissue GROUP BY project) m
WHERE i.project = 
AND maxpkey = i.pkey;

Is it a piece of JQL you are after? Or it SQL? and you want a report containing the last created issue in every project, one issue per project?

What are you doing? Are you trying to find old projects?

Hi Matthew,

we are performing in active projects through mysql DB so we required active and inactive projects plus last issue created in active and inactive projects.

I'd start here

The query wil lgive you all old projects

FROM project WHERE id NOT IN (SELECT project FROM jiraissue WHERE (created > '2011-07-01 00:00:00' AND updated > '2011-07-01 00:00:00'));

We also use the {run} and {sql} macros to run a report of old projects from Confluece. It takes a number which is the number of months old a project has to be to turn up on the report

{run:heading=Empty Projects Report|prompt=Find Empty & Old Projects|replace=numMonths::Months Ago:}

Select jira.project.pname,
       CASE WHEN tab1.IssueCounter is null then 0 else tab1.IssueCounter END as 'Issue Counter',
       tab1.LastUpdate as 'Last Update', LEAD as 'Project Lead'
from jira.project
Left join
(Select PROJECT,count(*) as 'IssueCounter',max(updated) as 'LastUpdate'
 from jira.jiraissue group by PROJECT) tab1
ON jira.project.ID=tab1.project
where tab1.LastUpdate < DATEADD(Month, $numMonths, getdate()) AND tab1.LastUpdate is not null
order by tab1.lastupdate asc


I'm sure it can be adapted to add who the last updater was

p.s. that was for MS-SQL so you will need to change the date functions to ther MySQL equivalent

there's something not right with the last query, will get back to you with a fix

no, it's fine! I just forgot, you have to put the number in as a negative due to the quirks of MS-SQL

Hi Mathew,

for getting active and inactive projects for last six months we use the below is the below query is correct or wrong

SELECT project.pname, COUNT(Jiraissue.pkey) AS Kount


project ON Jiraissue.PROJECT = project.ID

AND Jiraissue.created > '2012-08-007'

GROUP BY project.pname

ORDER BY project.pname,Kount

can you please little bit clear for last updated or last created issue in every project MYSQL query.

Hi Mathew,

please share the MYSQL query who last updated or created issue in thier project and i want this information for all the projects in jira.

Hi Kanthu,

It's not a report I have to hand as we don't use it. The only way to get the last updated person is that you'd have to search through the change history log as the last updater isn't stored in the jiraissues table. You'll only find assignee and reporter there, and reporter may, or may not be, the person who created it.

Hi Matthew,

I required a query in such a away that it should give active/inactive projects and last issue created date or updated for last 6 months.

I am not getting any thing the query which you have shared earlier as expected.

Hello Kanthu... well ok, just because it's a Friday and it's almost the weekend! I've written a specific query for you. It's quick & dirty and could probably be improved but if shoudl work.... it will give you the last issue updated (and when) for every project. you can set the date to show old projects. It doesn't have last updater because that information is in another table and it would require another join to do......

proj.pkey as PROJECT_KEY, 
proj.pname AS PROJECT_NAME,
lastchange.pkey as ISSUE_KEY,
lastchange.reporter AS REPORTER,
lastchange.assignee AS ASSIGNEE,
lastchange.UPDATED as LAST_UPDATE,
lastchange.summary  AS ISSUE_SUMMARY
from project proj,
   select * from jiraissue ji , (
      select project as maxproject, max(updated) as lastupdate from jiraissue
       group by project
   ) lastji
   where ji.project=lastji.maxproject and ji.updated=lastji.lastupdate
) as lastchange

and lastchange.updated <  '2012-08-07'
order by LAST_UPDATE

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in United States

From Atlassian: Confluence Security Advisory - 2019-03-20

Atlassian released a security advisory on 3/20/2019.  The full advisory is here: In a nutshe...

21 views 0 1
View post

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