Need help getting first and last name instead of username in my query. Edited

CM I'm New Here Oct 17, 2017

I created a query (pocketQuery) to query our JIRA database, which works fine. But I'm having issues properly gathering first and last name, instead of username's. Can anyone give me a hand with this, or point me in the right direction? I tried joining the cwd_user table without success. 

SELECT
pra.roletypeparameter AS "Member",
pr.name AS "Project Role",
p.pname AS "Project"
FROM
projectroleactor pra
LEFT JOIN projectrole pr ON pra.projectroleid = pr.id
LEFT JOIN project p ON pra.pid = p.id
WHERE p.pname = 'my group name'
OR p.pname = 'my group name'
ORDER BY p.pname;

 

 

 

2 answers

There is some bug in Atlassian community which restricts me from sending you this reply in text format, sorry for the inconvenience. :(

CM I'm New Here Oct 18, 2017

THANKS a lot for the help! I was able to get the information I needed with your feedback. 

One of my big problems was that I don't have access to the database using mysqldeveloper, only PocketQuery. So it's a lot of trail/error and running select * statements to see what fields exist in what table. I've seen some JIRA documentation on the DB schema, but it seems to not include all tables. I'm going to install the trail version locally on my dev workstation. 

 

Thanks again @MoroSystems Support.. here's my final working query.

SELECT
pra.roletypeparameter "Group",
u.display_name "Name",
pr.name "Project Role",
p.pname "Project"
FROM
projectroleactor pra
LEFT OUTER JOIN projectrole pr ON pra.projectroleid = pr.id
LEFT OUTER JOIN project p ON pra.pid = p.id
LEFT OUTER JOIN cwd_user u ON u.user_name = pra.ROLETYPEPARAMETER
WHERE p.pname = 'my project name here'
ORDER BY p.pname;

Thanks for sharing your query. I remember once trying to create an SQL query based solely on Jira DB documentation and well... never more. :) 

Hey CM,

great to see that your problem is solved. (You should probably accept MoroSystems answer to mark it as such)

Just letting you know that we have basically moved our support to our service desk for PocketQuerySo if you have any other problems, please don't hesitate to raise a ticket.

Thank you for using PocketQuery!

Best regards,
Sven (Scandio)

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot