简体   繁体   中英

Unable to update a table due to ERROR 1064 (42000)

I did realized that there have been concern raised regrading this error but this one quite different. I have a table below and unable to update it due to ERROR 1064. Please help

mysql> desc propertystring;
+---------------+---------------+------+-----+---------+-------+
| Field         | Type          | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+-------+
| ID            | decimal(18,0) | NO   | PRI | NULL    |       |
| propertyvalue | text          | YES  |     | NULL    |       |
+---------------+---------------+------+-----+---------+-------+
2 rows in set (0.01 sec)

UPDATE propertystring SET propertyvalue = 'x.x.x.x/jira' FROM propertyentry PE WHERE PE.id=propertystring.id and PE.property_key = 'jira.baseurl';

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 'FROM propertyentry PE WHERE PE.id=propertystring.id and PE.property_key = 'jira.' at line 1

Have tried different quotes but cannot update the feild. is it because field type is "text" ?

Thanks guys for the hint. @John Conde you are right the correct way to do this is as below without FROM clause UPDATE propertystring PS JOIN propertyentry PE ON PE.id=PS.id and PE.property_key = 'jira.baseurl' SET PS.propertyvalue = 'xxxx/jira';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM