Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

List all users in Confluence by space name and group name SQL server



how can i list all users of confluence with the group which he belongs and name of the space and key using SQL server

i want to obtain a table like :


Space Key | Space name | Username | Group name |

|                |                      |                  |                      |

1 answer

1 accepted

2 votes
Answer accepted
Alexis Robert Community Leader Jul 08, 2021

Hi @Marine Tm , 


this query is almost exactly what you need : 


SELECT distinct s.SPACENAME, s.SPACEKEY, cg.group_name, cu.lower_email_address
JOIN SPACEPERMISSIONS AS sp ON s.spaceid = sp.spaceid
LEFT JOIN user_mapping AS u ON sp.permusername = u.user_key
LEFT JOIN cwd_user AS c ON c.lower_user_name = u.lower_username
LEFT JOIN cwd_group AS cg ON sp.permgroupname = cg.group_name
LEFT JOIN cwd_membership AS cm ON = cm.parent_id
LEFT JOIN cwd_user AS cu ON = cm.child_user_id
WHERE cu.lower_email_address is not null 
ORDER BY s.SPACENAME, cu.lower_email_address;


Let me know if this helps,



Hello @Alexis Robert 


Thank you so much, the query works exactly as i wish.

Hello @Alexis Robert  do you have any sql query for adding a user into jira group or something that could help me to do it please?

Hi @Marine Tm , I'm not sure, it depends what exactly you need.

Can I suggest that you create a new topic and tag me ? I will then be able to look at your question.





Hi Alexis,

Shall i get  the same qurey for oracle?


Mugilan Sukumr

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,535 views 37 45
Read article

Community Events

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

Events near you