简体   繁体   中英

How to replace value of column with MySQL Query

I try to make some changes to my MySQL database, and I need to change values of this col name "id_lang" which values now is "6" to change to value "2".

This col is found in many tables, it will be great to have a single query which will to this for all DB at once.

by now i found this query,

SELECT REPLACE(yourcolumn,'ValueInTheColumnTobeReplaced', 'NewValue')  as replacedColumnName FROM yourtable

PS: I use PHPMYADMIN

but i cant make it work... PLease help me!!!

You have to use an Update query.

But you can not do this in one query for all tables.

Update yourTable set id_lang=2  where id_lang=6

使用此查询

 UPDATE yourTable SET id_lang=2 WHERE id_lang=6;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM