SQL Query help: Select all users with the assigned user groups

Annika Wagner January 16, 2019

Good afternoon,

I am looking for a bit of help to write a SQL query which will select all users with the assigned user groups.

Any help would be appreciated :) 

2 answers

1 vote
Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 16, 2019

Hi @Annika Wagner,

Please check the queries described in this link

Also Jira db tables doc can help you further: https://developer.atlassian.com/server/jira/platform/database-user-and-group-tables/

Annika Wagner January 18, 2019

Hi Tansu,

thank you for the links.

Best Regards,

Annika 

0 votes
josh
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.
January 16, 2019

Hi Annika,

Here's an example that works with MySQL:

select cwd_user.user_name, cwd_user.display_name, cwd_user.email_address, GROUP_CONCAT(cwd_membership.parent_name SEPARATOR ', ') as "MemberOf" from cwd_user inner join cwd_membership on cwd_membership.child_id = cwd_user.ID where cwd_membership.membership_type = "GROUP_USER" group by cwd_user.user_name, cwd_user.display_name, cwd_user.email_address 
Annika Wagner January 18, 2019

Hi Josh,

thank you for your quick reply. Your sql-script works very fine.

Best Regards,

Annika

Suggest an answer

Log in or Sign up to answer