A、B为2个不同的表,将A表的a字段赋值给B表的b字段:
update B set b = (select a from A where A.id = B.id) where B.b is null
注:where B.b is null为将B表的b字段为空的值赋值为A表的a字段
A表的a、b字段赋值,将表的b字段的值赋给a:
update A set a = (select b from (select id,b from A) B where B.id = A.id)
A、B为2个不同的表,将A表的a字段赋值给B表的b字段:
update B set b = (select a from A where A.id = B.id) where B.b is null
注:where B.b is null为将B表的b字段为空的值赋值为A表的a字段
A表的a、b字段赋值,将表的b字段的值赋给a:
update A set a = (select b from (select id,b from A) B where B.id = A.id)