Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change a lot of records at once in phpmyadmin

I'd like to know how to update several records at once where a certain column type is selected.

I have found how to select records. I have found how to update records. But i don't know how to do it both together for it to work.

Selecting:

SELECT * FROM users WHERE 'type'='new'

Updating:

update table
set column = 937

So basically i want to change the info in the 'column' to 937 in the 'table' if another column 'type' is 'new'.

Thanks,

like image 736
dirk Avatar asked Mar 14 '11 23:03

dirk


1 Answers

You can do this by simply adding a WHERE clause to your UPDATE statement:

UPDATE `users`
SET `myColumn` = 937
WHERE `type` = 'new'

Of course, change myColumn to match your column name

like image 130
Infotekka Avatar answered Sep 20 '22 22:09

Infotekka