2012-08-01 63 views
0

我試圖向某些列添加文本字符串。這是我試過的一個查詢,雖然失敗了,但它解釋了我想要做的事情。MySQL - 將字符串添加到文本列

SET @NAME = (Select name from item_template where itemset = 801); 
SET @NEWNAME = ('|cFFFF0000'[email protected]); 
Update item_template set name = @NEWNAME where itemset = 801; 

在此先感謝! :)

回答

0

嘗試

Update item_template 
set name = (select * from (select concat('|cFFFF0000', name) 
          from item_template 
          where itemset = 801) x 
      ) 
where itemset = 801; 

,甚至更短的

Update item_template 
set name = concat('|cFFFF0000', name) 
where itemset = 801; 
1

爲什麼不

update item_template set name = concat('|cFFFF0000',name) where itemset = 801; 
+0

哦,從來沒有用過concat。那麼謝謝你! :) – user1569552 2012-08-01 20:06:18