MyBB Community Forums

Full Version: Moving users from 1 group to another
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,
Can someone provide me an SQL Query to shift all users from 1 group to another?
Like all users from the validation group into the registered users.

Thanks.
Assuming your table prefix is mybb_, run this:

UPDATE `mybb_users` SET `usergroup` = '2' WHERE `usergroup` '5';
Yup! It is, thanks!
Hmm, this didn't work, got an error:

SQL query:

UPDATE mybb_users SET usergroup = '2' WHERE usergroup '5'

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''5'' at line 1
Dunno why it's doing that, try this then:

UPDATE `mybb_users` SET `usergroup` = 2 WHERE `usergroup` 5;
Happened again ;_;

I'm 100% positive they're using the mybb_ prefix as pretty much everything is called mybb_
Like mybb_users
mybb_forums
mybb_threads
mybb_posts

And I checked the group IDs to make sure too, you picked the right ones.

Quote:Error

SQL query:

UPDATE mybb_users SET usergroup =2 WHERE usergroup 5

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '5' at line 1
(2009-07-16, 09:31 AM)MattRogowski Wrote: [ -> ]Dunno why it's doing that, try this then:

UPDATE `mybb_users` SET `usergroup` = 2 WHERE `usergroup` 5;

UPDATE `mybb_users` SET `usergroup` = 2 WHERE `usergroup` = 5; 
Ah yes, that worked!

Thanks!
Oops, somehow missed the = both times Toungue
Can you please help me add another statement to that command; I need to move all members with a post count equal to or higher than 2.

Thanks in advance!
UPDATE `mybb_users` SET `usergroup` = 'X' WHERE `usergroup` = 'Y' AND `postnum` > '1';

Change X to the group to move them to and Y to the group they're in now.
Pages: 1 2