在MYSQL中连接字符串 [英] Concate String In MYSQL

查看:70
本文介绍了在MYSQL中连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在mysql中连接此字符串

How can i concate this string in mysql

desc=desc+$desct

我想要的是每次我从PHP插入一个变量时,都将字符串添加到已存在于db中且以 ||

what i want is each time i insert a variable from PHP that the string is added to the string which was already in db and seperated with ||

字段描述应如下所示

desc
10||30||90||710 

说我想加20

desc
10||30||90||710||20

然后desc字段应如下所示

then the desc field should look like this

推荐答案

使用MySQL CONCAT 函数:

Use MySQL CONCAT function:

UPDATE tblName SET colName = CONCAT(colName, "||20") WHERE ...;

这篇关于在MYSQL中连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆