我有一个表(config),其中包含字段'type'和另一个表(用户),其中包含字段'status'。
字段“status”的某些值为空。
如果另一个表中的字段'type'等于'3',我想将字段'status'更改为'applied'。
您能解释一下如何进行此查询吗?
答案 0 :(得分:0)
试试这个
update table2
inner join table1 on table1.id=table2.id
and table1.type=3
set status=applied
id是两个表中的公共字段