妻子长途中被轮 内兄:请教一个mysql语句

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 02:53:54
有两张表,表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);