Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the most recent comment of an issue in jira

Ashwini Ganesan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 31, 2023

Please share the query to get the most recent comment of an issue id in jira

 

SELECT CONCAT(P.pkey,'-',JI.issuenum) as issuekey, JA.actionbody, JI.updated as 'update', JI.id
FROM jira_jiraaction JA
JOIN jira_jiraissue JI ON JA.issueid = JI.id
JOIN jira_project P ON JI.project = P.id
WHERE JA.actiontype = 'comment'

this returns all the comment but I the most recent comment for each id

1 answer

0 votes
Mohamed Benziane
Community Champion
January 31, 2023

Hi,

You could do something like this

SELECT CONCAT(P.pkey,'-',JI.issuenum) as issuekey, JA.actionbody, JI.updated as 'update', JI.id
FROM jira_jiraaction JA
JOIN jira_jiraissue JI ON JA.issueid = JI.id
JOIN jira_project P ON JI.project = P.id
WHERE JA.actiontype = 'comment'
ORDER BY JA.id DESC
LIMIT 1

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events