2016-05-22 160 views
0

錯誤我想運行此查詢,但得到一個錯誤:錯誤1064:您的SQL語法

Error 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 'UPDATE `ads` SET `aDesc` = replace(aDesc, 'amp;', '')' at line 3

我的查詢是:

UPDATE `ads` 
SET `aName` = replace(aName, 'amp;', '') 
UPDATE `ads` 
SET `aDesc` = replace(aDesc, 'amp;', ''); 

什麼問題?

+0

能否請您正確格式化您的問題和疑問? – michaJlS

回答

1

您的查詢看起來像兩個沒有分隔符的查詢。

更有效的選擇是在一個查詢做到既改變:

UPDATE ads 
SET aName = replace(aName, 'amp;', ''), 
    aDesc = replace(aDesc, 'amp;', ''); 

,但如果你必須運行兩個查詢:

UPDATE ads SET aName = replace(aName, 'amp;', ''); 
UPDATE ads SET aDesc = replace(aDesc, 'amp;', '');