我有這個疑問MYSQL:在CONCAT使用列名()函數給出了語法錯誤1064
UPDATE `fitment_drums` SET `liters` = CONCAT(`liters`,'.0') WHERE `liters` LIKE '_'
導致這個錯誤:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''.0') FROM `fitment_drums` WHERE `liters` LIKE '_'' at line 1
當我代替普通字符串,如。 CONCAT ('asdf','.0')
它工作正常。我已經嘗試使用select語句作爲參數,並且也嘗試使用臨時表:
CREATE TEMPORARY TABLE t1 (SELECT * FROM `fitment_drums` WHERE liters like '_')
UPDATE `fitment_drums` SET liters = CONCAT(t1.liters,'.0') where t1.id = id
是一個數字字段嗎? – grahamj42
這是一個varchar字段。 – qSort
您的CREATE TABLE語句後面沒有分號。 –