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' 我要把这两条语句 加在一起求和 改怎么写求和语句。
展开
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)
(
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)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询