简体   繁体   English

错误代码:MySQL更新查询中出现1064

[英]Error Code : 1064 on MySQL update query

Table: immunization                 
id  vac_id  vaccine_id
1   5       0
2   5       0
3   3       0
4   4       0
5   4       0

Table: vaccine
id  vac_id
8   1
9   2
10  3
11  4
12  5

I have two table , now I want to set id of vaccine table into vaccine_id of immunization table by matching vaccine.vac_id = immunization.vac_id 我有两个表,现在我想通过匹配accurate.vac_id = immunization.vac_id将疫苗表的id设置为免疫表的vacuum_id

TO do It i have used the query like but getting error 1064 为此,我已经使用了查询,但是却收到错误1064

UPDATE immunization
SET  immunization.vaccine_id = vaccine.id
FROM vaccine,immunization
WHERE  vaccine.vac_id = immunization.vac_id
UPDATE immunization i
join vaccine v
on i.vac_id=v.vac_id
SET  i.vaccine_id = v.id

set comes last 集最后

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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