How to change many records at once in phpmyadmin

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

I found how to select entries. I found how to update records. But I do not know how to do this together so that it works.

Selection:

SELECT * FROM usersWHERE 'type' = 'new'

Update:

update table
set column = 937

So basically I want to change the information in column "937" in the "table" if the other type of column is "new".

Thank,

+5
source share
3 answers

You can do this by simply adding a UPDATEsentence to the statement WHERE:

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

, myColumn

+5

:

update users
set column = 937
where id in (select id from users where type='new')

, .

0

. MySQL . , "AS", . , , where, . .

    UPDATE tbl 
    SET field=newValue 
    WHERE tbl.key IN 
        (SELECT idNew FROM 
            (Select tbl.key AS idNew 
            FROM tbl 
            WHERE field=editValue) AS tblNew);
  • tbl -

  • -

  • newValue -

  • tbl.key -

  • idNew - , . - . 'id' 'id_new' 'id_n'

  • editValue -

  • tblNew - , . - 'tbl_n' 'tbl_new' 'tbl_test'

, , , , tbl, MySQL, , , .

, - !

0
source

All Articles