MySQL Mysql追加列值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13926239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mysql append column value
提问by Aravindhan
I am having the table with the following structure
我有以下结构的表
----------------------------
id content
---------------------------
1 abc
2 bca
---------------------------
I want to append the character 'd' with the field 'content' ... So i want the table structure as follows
我想在字段 'content' 中附加字符 'd' ... 所以我想要表结构如下
----------------------------
id content
---------------------------
1 abcd
2 bca
---------------------------
How can i do this..
我怎样才能做到这一点..
回答by Dhinakar
If you want update the column from the Table then use below Query
如果要更新表中的列,请使用下面的查询
update table1 set content = concat(content,'d');
If you want to select the column concatenation with 'd; the use below Query
如果要选择带有 'd; 的列连接;下面使用查询
select id, concat(content,'d') as content from table1;
Refer :
参考 :