Forums

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

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
TAGS
Atlassian, Team '25 Europe, Atlassian conference, AI-powered teamwork, Atlassian events, keynote speakers, Barcelona tech conference, Atlassian Williams Racing, Carlos Sainz, Jenson Button, Mike Cannon-Brookes, Anu Bharadwaj, Atlassian Rovo

Atlassian Williams Racing is coming to Team '25 Europe 🏎️

Discover the teamwork and precision behind success on and off the track. See how this high-performing team makes the impossible possible. Be one of the first 100 customers to register for a chance to win 2 tickets to an Atlassian Williams 2026 race.

Register now
AUG Leaders

Atlassian Community Events