Forums

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

How to get the issue previous status using SQL query?

Michał Gawlik
Contributor
March 26, 2015

Hi there,

Is a better way to get the previous state than getting it as the last row from the SQL query below?

SELECT 
TO_CHAR(grpit.newstring) AS new_state,
TO_CHAR(grpit.oldstring) AS old_state
FROM changegroup grp,
changeitem grpit
WHERE grp.id = grpit.groupid
AND grpit.field = 'status'
AND grp.issueid = <id>;

Thank you in advance!

Michal

1 answer

1 accepted

1 vote
Answer accepted
Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 26, 2015

I would add the changeitem.ID column to select list  and order by 'changeitem.ID desc'  I would then add a top 1 clause to only get back the first row.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events