Reputation: 7
In a database product_description I have an some empty values for a column named custom_title (vchar). I'd like to update it with the values (vchar) from another one named "name" and a text. I tried and return 0:
SELECT name + 'text' AS custom_title
FROM product_description
where custom_title is NULL
Upvotes: 0
Views: 966
Reputation: 2647
SELECT concat(name ,'text' ) AS custom_title FROM product_description where custom_title is NULL
if you want to update you need to use an update statement, not a select...
update product_description
set custom_title = concat(name ,'text' )
where custom_title is NULL
To do the uppercase of the fist letter...
SELECT concat(upper(substring(name, 0,1 )),substring(name, 2) ,'text' ) AS custom_title
FROM product_description where custom_title is NULL
Upvotes: 3