I am working to find users who have been left over active but have no active groups.
Although this sql query is helpful, it does not determine if they are still active or not:
SELECT *
FROM cwd_user
WHERE id NOT IN (SELECT m.child_user_id FROM cwd_membership AS m
JOIN cwd_group AS g ON m.parent_id = g.id
WHERE g.group_name = '<group_name>');
Having issues adding or similar:
where ACTIVE = 'T';
Any help would be greatly appreciated. Thanks
Confluence 6.6.6
Hi Mike,
For the most part, your SQL looks right however you'd want to use a lowercased "active" in your SQL if you want to filter by it. Something like this should work:
SELECT *
FROM cwd_user
WHERE id NOT IN (SELECT m.child_user_id FROM cwd_membership AS m
JOIN cwd_group AS g ON m.parent_id = g.id
WHERE g.group_name = '<group_name>')
and active = 'T' ;
What's happening when you try to include your where active condition?
Cheers,
Shawn
Thanks Shawn. I will see if I can work with this query output. My goal was to find users who are not associated to any groups and are active
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mike,
I get you now; try this one and it should give you a list of Active Users that do not have group memberships:
SELECT U.ID, U.user_name, G.group_name
FROM cwd_user U
LEFT JOIN cwd_membership M ON U.ID = M.child_user_id
LEFT JOIN cwd_group G ON G.ID = M.parent_id
WHERE M.child_user_id IS NULL
and U.active='T';
Cheers,
Shawn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perfecto!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.