Update a column of a table with append some values to the same column value in MySQL

吃可爱长大的小学妹 提交于 2020-01-06 09:54:30

问题


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


来源:https://stackoverflow.com/questions/7857746/update-a-column-of-a-table-with-append-some-values-to-the-same-column-value-in-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!