a表
id name
1 a
2 b
3 c
b表
dict_id dict_name
a d
b e
c f
a.name = b.dict_id
怎么把a表的name更新成b表的dict_name,
谢谢
update a
set a.name = b.dict_name
from b
where a.name = b.dict_id这种方式不行啊
update a set a.name
= (select b.dict_name
from b where b.dict_id
=a.name
) ;
update a set name=(select dict_name from b where a.id=B.?) 你的b表的ID没有跟a表对应的字段
update a
set a.name = b.dict_id,
a.name2 =b.dict_name
from b
where a.name = b.dict_id