帮忙么网 > MySQL > 当前页面

SQL语句

2024-12-25 NEW个对象

表B:id,name,code,detail四个字段均有值;表A id,name,code,detail其中id,name有值并且与表B相对应,code,detail值为null。

现在将B表中的code和detail值更新到A表中。


update t_a a set 

a.code=(select code from t_b b where b.id=a.id ), 

a.detail=(select detail from t_b b where b.id=a.id );

相关文章

推荐文章