PDA

View Full Version : query to move 20,000 members to temp usergroup based upon userid


Antivirus
09-25-2007, 11:39 PM
Is the following manual query safe to run to move a large amount of users to a different primary usergroup based upon their userid?


UPDATE user
SET usergroupid = 34
WHERE userid < 24509


Just want to make sure nothing is missed (settings / data in other tables) when doing such thing through CP
Thanks!

Cars2007
09-25-2007, 11:49 PM
Back up your forums first.

I did something like this the other week and it worked just fine.

Antivirus
09-25-2007, 11:59 PM
already backed up[, just want to make sure the usergroupid doesn't need to be handled elsewhere. for instance, such as displaygroupid, user title, etc...

Dismounted
09-26-2007, 06:37 AM
If you're using the default user title ladder, the usertitle field should be fine.

Marco van Herwaarden
09-26-2007, 09:21 AM
:eek:
I hope that you know what you are doing, as the example you provided would move ALL users with a userid smaller then 24509 (including an admin with id = 1 for example???) to this new usergroup.

Paul M
09-26-2007, 11:28 AM
You should update the displaygroupid as well (if it's not '0' and is equal to their existing primary group).

Antivirus
09-27-2007, 06:41 PM
:eek:
I hope that you know what you are doing, as the example you provided would move ALL users with a userid smaller then 24509 (including an admin with id = 1 for example???) to this new usergroup.

Naturally, actually the query would be as follows:

UPDATE user
SET usergroupid = 34
WHERE userid < 24509
AND usergroupid = 2


You should update the displaygroupid as well (if it's not '0' and is equal to their existing primary group).
Ok, thanks that's what i was wondering, if there were any other values that should be updated in tandem.

Thanks to both of you :)