简体   繁体   中英

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

TO do It i have used the query like but getting error 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

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