PDA

View Full Version : MySql Query help


jbear6
11-07-2003, 09:29 PM
Is there a way to change 30 or 40 members to a different usergroup (all at once) using MySql? I tried to figure this out on my own, but it didn't figure out right :)

Thanks,
Jack

Lesane
11-08-2003, 09:18 AM
Try something like:


UPDATE user SET usergroupid='1' WHERE userid IN (2)


where 1 = usergroupid and 2 are the userid's seperated by , (like: 1,2,3)

jbear6
11-08-2003, 02:42 PM
Thank you Lesane, but I think I messed this up too. I tried this:
UPDATE user SET usergroupid='8' WHERE userid IN (test1,test2,test3,test4)

and received this error: MySQL said: Unknown column 'test1' in 'where clause'

(test1,test2,test3,and test4 are new members I added before doing the query)

Thanks again,
Jack

jbear6
11-08-2003, 02:49 PM
Nevermind......I'm stupid.
User ID, not username. It worked like a champ. You've saved me hours of individual changes, Thanks again :)

Jack

Lesane
11-08-2003, 07:40 PM
hehe np, glad i could help.