MyBB Community Forums

Full Version: Query for moving users from specific GID to another GID
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

as title states, I would like to know the MySQL query to be ran to shift a users from specific group to another group.

Thanks.
UPDATE mybb_users SET usergroup=X WHERE uid=Y


X is the GID of the usergroup and Y is the UID of the user.
You taking it wrong I guess.

I am saying I wanna MASS move users from one usergroup to other.

I got about 50 users that are supposed to be moved to normal group, I guess this is for a specific user as it indices UID.
UPDATE mybb_users SET usergroup=X WHERE usergroup=Y

X is the GID of the usergroup you want to move them into and Y is the GID of their original usergroup.
Sure, I would try it out later, thanks.
Instead of a Usergroup you can move UIDs from one Usergroup to another, you just need to describe those IDs in an array like this;
UPDATE `mybb_users` SET `usergroup` = 'X' WHERE `uid` IN (1,2,3,4);

You need to Change 1,2,3,4 to the UserIDs you wish to Change their Usergroup to X. Where X is your New Usergroup.
(2011-04-18, 04:15 PM)Yaldaram Wrote: [ -> ]Instead of a Usergroup you can move UIDs from one Usergroup to another, you just need to describe those IDs in an array like this;
UPDATE `mybb_users` SET `usergroup` = 'X' WHERE `uid` IN (1,2,3,4);

You need to Change 1,2,3,4 to the UserIDs you wish to Change their Usergroup to X. Where X is your New Usergroup.
It would be again manual work to find and add those UIDs, instead if I run this:

UPDATE mybb_users SET usergroup=X WHERE usergroup=Y

The users of the group 1 would be moved to group 2.

Am I correct?

Yes, that's the query I gave you. It works. I've tested it.
Great, that did its work.