2014-02-12 240 views
0

我有一個包含列圖像的表。在圖像列中,值存儲爲abc.png,xyz.png,agh.png。現在我想用xyz.png,agh.png更新列。我使用下面的代碼。但它不起作用。請幫幫我。你的幫助將不勝感激。用mysql中的另一個字符串替換字符串

update table set images=(select REPLACE(images,'45021.jpg',' ') from table where id='6') where id='6' 

SQL是顯示以下錯誤: 您不能指定目標表「表」的更新在FROM子句

回答

0

您不必爲此進行子選擇。

UPDATE `table` 
    SET `images` = REPLACE(`images`, '45021.jpg', ' ') 
WHERE `id`= 6 
+0

謝謝你的回答。我犯了這個愚蠢的錯誤。 – Vinie

0

表yourtablename?

update tablename set images=REPLACE(images,'45021.jpg',' ') where id='6' 
相關問題