Please, step away from the database. It is NOT designed for reporting in any shape, and there is almost certainly a much better way to do what you want.
Could you explain why you are looking at it? And who gave you the terrible idea of using SQL to do it?
(If you must, then start with changegroup - it has an issue column which is the id of the jiraissue, and then the id column in changegroup is used to identify the changeitems in that group)
For anyone else looking to retrieve and process historical data from Jira e.g. for their reports plugin (which was my usecase) and stumbling upon the change* tables in the DB and this question, two suggestions before you dig into building jdbc connections or such things:
Strongly seconding the warning from @Nic Brough _Adaptavist_!!!
That said, some people like to poke around under the hood... :)
Our instance necessitates DB updates sometimes. We use SQL to redact potentially sensitive text without deleting tickets. (Just editing a field doesn't remove the old value from the history tab so sensitive text could still be visible.)
Here is the oracle SQL we use to join all these tables together to basically recreate a ticket's changelog.(Enter your ticket key on the last line) Check out the join clauses to answer your question.
(Works on Jira 6.1+)
p.pkey||'-'||i.issuenum as "KEY",
cg.created as Modified,
dbms_lob.substr(ci.oldstring, 4000, 1) as OLD_String,
dbms_lob.substr(ci.newstring, 4000, 1) as NEW_String,
dbms_lob.substr(ci.oldvalue, 4000, 1) as OLD_Value,
dbms_lob.substr(ci.newvalue, 4000, 1) as NEW_Value,
ci.id as Change_Item_Id
FROM changeitem ci
JOIN changegroup cg on ci.groupid = cg.id
JOIN jiraissue i on cg.issueid = i.id
JOIN project p on i.project = p.id
WHERE p.pkey||'-'||I.issuenum in ('KEY-123')
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events