[英]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.