求助一个sql语句?大家帮忙。

geian 2009-10-27 03:23:36
有两张表 A,B
A中有年份NF,部门号BMH,工资GZ
B中有年份NF,部门号BMH,平均工资PJGZ
现在要UPDATE A表,根据B表初始化A表,要求A的更新是根据B的年份,部门号一致?
大家帮忙!
...全文
74 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangheguyun 2009-10-27
  • 打赏
  • 举报
回复
update A set a.gz=b.pjgz from a,b where a.nf=b.nf and a.bmh=b.bmh
nianran520 2009-10-27
  • 打赏
  • 举报
回复

update A set A.gz=B.pjgz,A.FL=B.FL
from A,B
where A.BMH=B.BMH AND A.NF='2010'
7761098 2009-10-27
  • 打赏
  • 举报
回复

update a
set gz=pjgz,
fl=pjfl
from a,b
where a.nf=b.nf and a.bmh=b.bmh

geian 2009-10-27
  • 打赏
  • 举报
回复
那么有gz工资,福利fl。
且都是nf2010年怎么写?
yben 2009-10-27
  • 打赏
  • 举报
回复
update A set a.gz=b.pjgz from a,b where a.nf=b.nf and a.bmh=b.bmh
ming_Y 2009-10-27
  • 打赏
  • 举报
回复
up
jwdream2008 2009-10-27
  • 打赏
  • 举报
回复
update A set 工资GZ = 平均工资PJGZ from A,B where A.NF=B.NF And A.BMH=B.BMH 
nianran520 2009-10-27
  • 打赏
  • 举报
回复

update A set A.gz=B.pjgz
from A,B
where A.BMH=B.BMH AND A.NF=B.NF
bancxc 2009-10-27
  • 打赏
  • 举报
回复
update a set gz=b.pjgz
from a , B where a.nf=b.nf and a.bmh=b.bmh
华夏小卒 2009-10-27
  • 打赏
  • 举报
回复

update a
set gz=pjgz
from a,b
where a.nf=b.nf and a.bmh=b.bmh
??

34,594

社区成员

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

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