求一个SQL语句

hexinyu2005 2006-08-17 09:39:52
有一个表 A
aid bid cid sumvalue
1 2 3 0
2 2 3 0
3 2 3 0

还有一个表B
aid bid cid sumvalue

2 2 3 88


现在想把B的数据插入到A中去,要求aid,bid,cid都是对得上的,结果就是

有一个表 A
aid bid cid sumvalue
1 2 3 0
2 2 3 88
3 2 3 0
...全文
99 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mugua604 2006-08-17
  • 打赏
  • 举报
回复
update a set sumvalue=b.sumvalue
from a,b on a.aid=b.aid and a.bid=b.bid and a.cid=b.cid
xyxfly 2006-08-17
  • 打赏
  • 举报
回复
update a set sumvalue=b.sumvalue
from a,b where a.aid=b.aid and a.bid=b.bid and a.cid=b.cid
fcuandy 2006-08-17
  • 打赏
  • 举报
回复
update a set sumvalue=b.sumvalue
from a inner join b on a.aid=b.aid and a.bid=b.bid and a.cid=b.cid
不排除手误

34,590

社区成员

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

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