前挡贴膜贴里面贴外面:请教一个mysql语句

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/27 16:34:26
有两张表,表A 里有字段1 / 2 ,表B里有字段3/4 。

1和3是有对应关系的,代表相同的ID好。现在想要select A表里2的值,覆盖B表中4的值这个mysql句怎么写?

update b
set 4=(select 2 from a where a.1=b.3)
where a.1=b.3

update b set b.4=(select a.2 from a where a.1=b.3);