开发者

Mysql - How to update a column using another column's value plus some strings

开发者 https://www.devze.com 2022-12-19 19:52 出处:网络
I have a table with the following column & value: ColA = \"8765\" ColB = \"2137\" I would like to update ColB in the same table to the following value:

I have a table with the following column & value:

ColA = "8765" ColB = "2137"

I would like to update ColB in the same table to the following value:

ColC = "开发者_StackOverflow[8765][2137]"

How can I do it using phpmyadmin (meaning just sql syntax)?


UPDATE table SET ColC = CONCAT("[", ColA, "][", ColB, "]");


UPDATE
    myTable
SET
    ColC = CONCAT('[', ColA, '][', ColB, ']')
--WHERE...


Use only this one! I've tested on the live server.

UPDATE table SET column_name = CONCAT( Column_A, ' ', Column_A );

In between single quotes will add a space. You can remove that if it is not required.

0

精彩评论

暂无评论...
验证码 换一张
取 消