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
我有两个表,现在我想通过匹配vaccine将疫苗表的id设置为免疫表的vaccine_id。Vac_id = immune . Vac_id
我已经使用了查询,但得到错误1064UPDATE 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