Find Statuses of all issues in a project on a given date in the past using Oracle

I am trying to find a query that I can use from the backend to query issue counts for statuses on the given date in the past and so that it does not show it's current status but the status that it has back then.

2 answers

1 accepted

This widget could not be displayed.

Hi Karl,

I believe you can use the following query to achieve that:

SELECT JI.pkey, STEP.STEP_ID
FROM (SELECT STEP_ID, ENTRY_ID
      FROM OS_CURRENTSTEP
      WHERE OS_CURRENTSTEP.START_DATE < '<your date>'
UNION SELECT STEP_ID, ENTRY_ID
      FROM OS_HISTORYSTEP
      WHERE OS_HISTORYSTEP.START_DATE < '<your date>'
      AND OS_HISTORYSTEP.FINISH_DATE > '<your date>' ) As STEP,
(SELECT changeitem.OLDVALUE AS VAL, changegroup.ISSUEID AS ISSID
      FROM changegroup, changeitem
      WHERE changeitem.FIELD = 'Workflow'
      AND changeitem.GROUPID = changegroup.ID
UNION SELECT jiraissue.WORKFLOW_ID AS VAL, jiraissue.id as ISSID
      FROM jiraissue) As VALID,
jiraissue as JI
WHERE STEP.ENTRY_ID = VALID.VAL
AND VALID.ISSID = JI.id
AND JI.project = <proj_id>;

This query is taken from the following documentation, where you have additional examples that might be helpful as well:

Example SQL Queries for JIRA

Hope it helps!


Cheers,

Clarissa.

do you know how i get status name and not number like this query provides?

I have read this response on several sites. It returns the step ID which can be linked back to issuestatus.sequence column. However, that is not correct information. The issues are always returning between step ID 1 and 5 which map to default statuses. However, I have custom statuses and I want to see all the issues that were in that status on a certain date but cannot find them.

This widget could not be displayed.

You can use the issuestatus table on the DB. This table links the status name and status ID.

Cheers,

Clarissa.

I am sorry I think i just got a bit confused. It returns me step id which does not match status from the issuestatus table. is there a step id description table? Thanks

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 Wednesday 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...

165 views 2 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