SQL Query all changes of given custom field last 24 hours post JIra 6.0

William Gunkel November 25, 2014

I had nice query to pull the change data for a custom field for last 24 hours post update from 5.11 to 6.3 the query is broken since the 'pkey' field is not longer used.

 

SELECT
changegroup.created as "Updated",
jiraissue.pkey,
cwd_user.display_name as "Changed by",
changeitem.oldstring as "Old Version",
changeitem.newstring as "New Version"
FROM changeitem
INNER JOIN changegroup ON changegroup.ID = changeitem.groupid
INNER JOIN jiraissue ON changegroup.issueid = jiraissue.id
INNER JOIN cwd_user on changegroup.author = cwd_user.user_name
WHERE
"public".changeitem.field = 'Target Version' AND
"public".changegroup.created >= now() - INTERVAL '1 DAY'
ORDER BY
"public".jiraissue.created DESC

 

 

1 answer

1 accepted

0 votes
Answer accepted
Marc Minten _EVS_
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.
November 25, 2014

Replace "issue.pkey" by "project.pkey + '-' + CAST(jiraissue.issuenum AS varchar(9))"

and add join "inner join project on jiraissue.project = project.id"

This is SQL Server SQL code, you can easily adapt for other databases... smile

William Gunkel November 25, 2014

Thanks for the help worked

Suggest an answer

Log in or Sign up to answer