JIRA DB query to get status of all issues on a previous date

select newvalue,issueid,created from jiraschema.changegroup,jiraschema.changeitem
where changegroup.created < '02/05/2013' AND
changeitem.GROUPID = changegroup.ID
)as CH1
left outer join (
select newvalue,issueid,created from jiraschema.changegroup,jiraschema.changeitem
where changegroup.created < '02/05/2013' AND
changeitem.GROUPID = changegroup.ID
) as
 CH2
on (CH1.issueid = CH2.issueid and CH1.created < CH2.created)
where CH2.issueid is null

This is what I'm using finding the max created date from changegroup table from the given date and getting the newvalue . THis gives some results , but missses out on issues which are created and no activity has been done as yet . Those will not be listed in this table and th eonly entry I find is in the assignee field with the new value as the username for the user .

1 answer

This widget could not be displayed.

Hi Pushparaj,

I believe you can use the following query to help you 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 retrieves the status of all issues on a give date in a give project. You can find more query examples at: Example SQL Queries for JIRA

Hope this helps!

Cheers,

Clarissa.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Friday in Jira

New 5k User Limit and Other Cloud Updates

Hi all! Lauren here from the Enterprise Cloud marketing team.  I have some exciting Cloud updates from #AtlassianSummit that I wanted to share. We want everyone in your organization to be ab...

91 views 0 3
Read article

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