Forums

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

How can I do a SQL join on jiraissue and jiraaction?

Royce
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 17, 2018

I'm trying to write a SQL script that will find all the actions a particular member of our staff has done.

When I do a join on ID it mixes results from different tickets.

 

Is Id not unique per ticket>

 

select
jiraaction.author,
jiraaction.actiontype,
jiraaction.actionbody,
jiraissue.id,
jiraaction.id,
jiraissue.reporter,
jiraissue.assignee,
jiraissue.creator,
jiraissue.summary,
jiraissue.description,
jiraissue.created,
jiraaction.created,
jiraaction.updateauthor,
jiraaction.updated

from jiraissue
join jiraaction
on
    jiraaction.id = jiraissue.id

1 answer

0 votes
Nic Brough -Adaptavist-
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.
August 17, 2018

SQL is the worst possible way to report on jira data.

But if you insist, then it is important to understand that most Jira tables have an id that uniquely identifies a record in them (you don't need that in a proper database, but that's one of many reasons reporting this way is bad.  The Jira database is NOT a database, it's a data store).

For your query, you need to join on jiraaction.issueid = jiraissue.id

Royce
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 21, 2018

Thanks, I'm not wedded to SQL, I just couldn't see any other way to see all the comments made across the system by an individual user.

Suggest an answer

Log in or Sign up to answer