咬手鲨鱼玩具:请教一个mysql语句

来源:百度文库 编辑:高考问答 时间:2024/05/10 20:02:07
有两张表,表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);