sql 语句请教,谢谢
sql吧
全部回复
仅看楼主
level 1
shysand
楼主
表F1
表F2
我现在想要实现: 表F2中的相同的sd 字段 对应s1的值,求总和,将值存到表F1对应id=sd 的字段i1列中
求帮忙,谢谢!!
2019年07月08日 02点07分
1
level 9
张先生捧场啦☜
可以找我582152734
2019年07月08日 03点07分
2
level 5
怎么会那么难😂
帮你写了下。参考一下
2019年07月09日 13点07分
3
level 11
江南如雾九方殇
Oracle:
update F1 t set i1=(select sum(s1) from F2 where sd=t.id) where exists (select 1 from F2 where sd=t.id);
SQL Server:
update t set i1=(select sum(s1) from F2 where sd=t.id) from F1 t where exists (select 1 from F2 where sd=t.id);
2019年07月13日 17点07分
6
1