jira query to display the date of first comment by someone other than reporter

Is there any way to write a JIRA query which displays the date of each issue's first comment (plus next I want to refine that to first comment by someone other than the reporter)?   I think not, but just checking.

3 answers

This widget could not be displayed.

Hey Stephen!

Good news for you: the query is not only possible, I also just wrote it for you and you can test just by copying it below and running on your database. wink

warning Be aware that this query was wrote and tested on a PostgreSQL database, so you may have to adapt according to your database type.

SELECT DISTINCT(CONCAT(p.pkey, '-', ji.issuenum)) AS "Issue", 
    ja.created AS "Date of first comment", 
    ja.actionbody AS "Comment" 
FROM jiraaction ja 
    JOIN jiraissue ji ON ja.issueid = ji.id
    JOIN project p ON ji.project = p.id
WHERE actiontype='comment'
    AND ji.reporter != ja.author




This widget could not be displayed.

That's awesome!

I should have said JIRA "filter" instead of query.   I was hoping I could do it with JQL.

But I think I just need to ask for db query permission and do this using sql like you proposed.  

I can see from what your sql needs to do that I was just having a nice fantasy that it could be done from advanced search using JQL. smile

At this point you cannot achieve this kind of result with a JQL query, as it's very basic, not including advanced functions like 'JOIN'. :( By the way, I made a mistake on the query, which I just corrected. I have updated it and should perform way better! ;)

This widget could not be displayed.

I believe Atlassian recommends using jql rather than SQL, since SQL gives full access to all data in JIRA including restricted issues. And SQL queries are not allowed in Cloud

For non-cloud script runner is a better approach I think

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

54 views 1 0
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