大力 邹建 四脚蛇 快来!!

zhuimeng313 2003-12-09 02:36:44
table1:

shbzh yhzh if_ssff
--------------------------
11111 451 是
22222 452 是

table2:

shbzh yhzh if_ssff
--------------------------
11111 null 是
22222 null 是

看看图 我想写个语句 按照shbzh 相对应 让下面的null 本别变成451 452
也就说
变成这样
table2:
shbzh yhzh if_ssff
--------------------------
11111 451 是
22222 452 是
...全文
91 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
pengdali 2003-12-09
  • 打赏
  • 举报
回复
update table2 set yhzh=a.yhzh from table1 a where a.shbzh=table2.shbzh
lvltt 2003-12-09
  • 打赏
  • 举报
回复
update table2
set yhzh=a.yhzh from table1 tem where tem.shbzh=table2.shbzh
zjcxc 元老 2003-12-09
  • 打赏
  • 举报
回复
update table2 set yhzh=(select shbzh from table1 where yhzh =a.yhzh)
from table2 a
dlpseeyou 2003-12-09
  • 打赏
  • 举报
回复
update t2
set t2.yhzh=t1.yhzh from t1 where t2.shbzh=t1.shbzh
realgz 2003-12-09
  • 打赏
  • 举报
回复
update t2
set t2.yhzh=t1.yhzh,t2.if_ssff=t1.if_ssff
from table1 t1,table2 t2
where t2.shbzh=t1.shbzh

34,837

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧