2021-01-28, 04:09 PM
Ok so we're about to make some changes to how our user groups work to try and simplify years of too many options
I'm trying to come up with a way to query various current group types to find any outliers who in the past where potentially left with multiple groups. I'd like to fix these before we make these blanket changes. At the moment I'm simply trying to find any members who have our base level as their primary group and then anything at all in additionalgroups. My SQL knowledge is mediocre at best and when we get into multiple tables I get more twisted than carnival funnel cakes. Here's where I am at the moment:
Again, the goal for this example is that I get a list of users who are part of group 8 but also have data in the additionalgroups column. The above is giving me all members who are in group 8. I see hundreds that have nothing in the addtionalgroups column of the user table.
Anyone able to nudge me in the right direction?
Thanks,
gmO
I'm trying to come up with a way to query various current group types to find any outliers who in the past where potentially left with multiple groups. I'd like to fix these before we make these blanket changes. At the moment I'm simply trying to find any members who have our base level as their primary group and then anything at all in additionalgroups. My SQL knowledge is mediocre at best and when we get into multiple tables I get more twisted than carnival funnel cakes. Here's where I am at the moment:
SELECT
u.username as Member,
u.usergroup as priGroup,
u.additionalgroups as othrGroups,
u.displaygroup as displayGroup,
ug.title as Status,
uf.fid5 as Realm
From mybb_users u,
mybb_userfields uf,
mybb_usergroups ug
where u.uid = uf.ufid
and u.usergroup = ug.gid
and u.usergroup in (8)
and u.additionalgroups is not NULL
Order BY
ug.title,
u.username
Again, the goal for this example is that I get a list of users who are part of group 8 but also have data in the additionalgroups column. The above is giving me all members who are in group 8. I see hundreds that have nothing in the addtionalgroups column of the user table.
Anyone able to nudge me in the right direction?
Thanks,
gmO