Update a column of a table with append some values

2019-08-23 14:08发布

问题:

Lock issue occurred when i tried to update a Column of a table with concatenate the same column value with some characters.

UPDATE Templates 
   SET TemplateName = CONCAT("'", (SELECT TemplateName 
                                           FROM Templates 
                                          WHERE LogID = 2), '_Validated',"'")
 WHERE LogID = 2; 

Is there any possible ways to achieve this?

回答1:

Use:

UPDATE TEMPLATES
   SET TemplateName = CONCAT("'", templatename, '_Validated')
 WHERE LogID = 2