簡體   English   中英

更新mysql中的longtext字段

[英]Update longtext field in mysql

我試圖像這樣在mysql客戶端中使用簡單的sql查詢來更新名為'comment'的longtext類型字段:

Update mytable set comment='Test' where id = 1;

但是我收到這個錯誤

ERROR 1064 (42000): 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 'comment='Test' where id = 1' at line 1

我錯過了什么嗎?,在此先感謝。

comment是一個保留字 ,如果要使用具有該名稱的表/字段,則必須用引號引起來(或使用table.fieldname語法,如果是字段)。 mysql中的default是它的背景,所以:

 update mytable set `comment`='Test' where id = 1;

找到了,就解決了:

update mytable as a set a.comment='Test' where id = 1;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM