开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜