mysql> update aos_service_hostname set department_id = aos_server_machine.department_id from aos_server_machine where aos_service_hostname.id = aos_server_machine.host_id; 
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 aos_server_machine where aos_service_hostname.id = aos_server_machine.host_' at line 1 
觉得没有错误啊,表结构大体的是这样的 mysql> desc aos_service_hostname; 
+--------------+--------------+------+-----+---------+-------+ 
| Field        | Type        | Null | Key | Default | Extra | 
+--------------+--------------+------+-----+---------+-------+ 
| id          | int(11)      | NO  | PRI | NULL    |      | 
| department_id    | varchar(255) | YES  |    | NULL    |      | mysql> desc aos_server_machine; 
+----------------+--------------+------+-----+---------+-------+ 
| Field          | Type        | Null | Key | Default | Extra | 
+----------------+--------------+------+-----+---------+-------+ 
| serial_number  | varchar(32)  | NO  | PRI | NULL    |      | 
| host_id        | varchar(255) | NO  |    | NULL    |      | 
| department_id  | int(11)      | YES  |    | NULL    |      |