SQL 求和语句
2个回答
展开全部
select
sum(*)
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'))
sum(*)
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'))
展开全部
SELECT
SUM(zy_detail_charge.charge_amount)
,SUM(mz_charge_detail.quantity)
FROM
zy_detail_charge
,mz_charge_detail
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'
and
zy_detail_charge.charge_code=mz_charge_detail.charge_item_code
SUM(zy_detail_charge.charge_amount)
,SUM(mz_charge_detail.quantity)
FROM
zy_detail_charge
,mz_charge_detail
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'
and
zy_detail_charge.charge_code=mz_charge_detail.charge_item_code
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询