Retrieve only users that have created or edited an issue

We're looking at merging two JIRA instances, and we're using a custom authenticator on one of the instances that means we can't do a straightforward query for user logins (the way we're doing things means the JIRA DB is not storing user instances).

However, we can see user activity.

What's the best way (mySQL) to retrieve only users that have created or edited an issue, returning the username, issue, and timestamp of last creation (or last edit) in something like M/D/Y TT format?

2 answers

1 accepted

1 votes
Timothy Chin Community Champion Aug 05, 2013

If you are looking for the create, then you are looking for the reporter column in the jiraissues table. Though, a reporter can be edited which brings us to the edit action.

You will find the change history in the changegroup and one changegroup has many changeitems.

0 votes
Boris Berenberg Community Champion Aug 05, 2013

Here you go for created:

WITH MAXRESULT AS (SELECT reporter, max(date(created)) as maxdate from jiraissue group by reporter)

SELECT distinct(ji.reporter), ji.pkey, Maxresult.maxdate from jiraissue ji
RIGHT JOIN MAXRESULT ON (maxresult.reporter = ji.reporter)
WHERE maxresult.maxdate = date(ji.created)

Here you go for updated:

WITH MAXRESULT AS (SELECT reporter, max(date(updated)) as maxdate from jiraissue group by reporter)

SELECT distinct(ji.reporter), ji.pkey, Maxresult.maxdate from jiraissue ji
RIGHT JOIN MAXRESULT ON (maxresult.reporter = ji.reporter)
WHERE maxresult.maxdate = date(ji.created)

*These are for PSQL not MySQL. You may need to tweak them for MySQL.

Note: What Timothy mentions above is 100% correct. This ignores the changeitem table, and it also falls prey to the field value being edited.

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,932 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