在数据库product_description 中,名为custom_title (vchar) 的列有一些空值。 我想用另一个名为“name”的值(vchar)和文本来更新它。 我尝试返回0:
SELECT name + 'text' AS custom_title
FROM product_description
where custom_title is NULL
最佳答案
SELECT concat(name ,'text' ) AS custom_title FROM product_description where custom_title is NULL
如果你想更新,你需要使用更新语句,而不是选择...
update product_description
set custom_title = concat(name ,'text' )
where custom_title is NULL
<小时/>
将第一个字母变为大写...
SELECT concat(upper(substring(name, 0,1 )),substring(name, 2) ,'text' ) AS custom_title
FROM product_description where custom_title is NULL
关于mysql - 将列与 mysql 中的文本合并,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17685829/