SQL 求和语句

SELECTSUM(zy_detail_charge.charge_amount) FROMzy_detail_chargewherezy_detail_cha... SELECT SUM(zy_detail_charge.charge_amount) FROM zy_detail_charge where zy_detail_charge.charge_code in (select fee_code from or_level where  or_level = 'xt' and flag = '410')and data_month ='2010-08'SELECT SUM(mz_charge_detail.quantity) from mz_charge_detail where mz_charge_detail.charge_item_code in (select fee_code from or_level where  or_level = 'xt' and flag = '410')and data_month ='2010-08'    我要把这两条语句 加在一起求和 改怎么写求和语句。 展开
 我来答
上天入地_9527
推荐于2017-04-22 · 超过14用户采纳过TA的回答
知道答主
回答量:36
采纳率:0%
帮助的人:45.2万
展开全部
select sum(a.a) from
(
SELECT SUM(zy_detail_charge.charge_amount) FROM zy_detail_charge where zy_detail_charge.charge_code in (select fee_code from or_level where or_level = 'xt' and flag = '410')and data_month ='2010-08'
union all
SELECT SUM(mz_charge_detail.quantity) from mz_charge_detail where mz_charge_detail.charge_item_code in (select fee_code from or_level where or_level = 'xt' and flag = '410')and data_month ='2010-08'
) a(a)
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
yiyishuitian
2012-03-03 · TA获得超过644个赞
知道小有建树答主
回答量:721
采纳率:50%
帮助的人:524万
展开全部
select sum(charge_amount)
from
(
查询A
union all
查询B
)
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式