A:select sum(a*b) from m , h
where type = 2 and m.code = h.code ;
B:select sum(a*b) from m , h1
where type = 2 and m.code = h1.code;
怎么做A+B?
1.打开一个数据中包含整数值的表,可以看到右下角的表数据。
2.在数据表中自动+1,如图所示,可以写入更新biao1集的年龄=年龄+1。
3.选择UPDATE biao1 SET age=age+1语句,点击左上角的执行查询按钮或按f9执行该语句,依次执行。
4.最后,将SQL修改为UPDATEbiao1SETage=age*2,执行这条语句,将字段x2中的值进行运算,那么就是结果的和。
报错了 缺失右括号
追答(ss1 +ss2)
追问还是一样报 右括号缺失 错误在是 s1后的,
追答最后少了一个括号:
select ss1 +ss2 from(
(select sum(a*b) as ss1 from m , h
where type = 2 and m.code = h.code )s1,
(select sum(a*b) as ss2 from m , h1
where type = 2 and m.code = h1.code)s2) )
还是那样的问题
追答from 后面要有一个空格
追问额(⊙o⊙)… 不行的
追答那只能使用相关函数或者采用类似楼下的回答啦,你的oracle数据库吗?
追问是oracle,谢谢了
追答那方法就多啦,比如:
select
(elect sum(a*b) as ss1 from m , h
where type = 2 and m.code = h.code )+
(select sum(a*b) as ss2 from m , h1
where type = 2 and m.code = h1.code)s2)
from dual
手机WPS表格中函数sum进行对数据求和,这样移动办公好