日期:2014-05-17 浏览次数:21235 次
SELECT
(SELECT SUM(SFO.QTY) --预算数
FROM SN_FACT_ORDER_COST SFO, SN_DIM_PART SDPI
WHERE SFO.CHANGE_TYPE = 'TYPE_DD' --订单,采购) 2012年申请
(SELECT SUM(SFO.QTY) --预算数
FROM SN_FACT_ORDER_COST SFO, SN_DIM_PART SDPI
WHERE SFO.CHANGE_TYPE = 'TYPE_FF' --发放)2012年发放
FROM FACT_ORDER
select qty1,qty2,qty1/qty2 from(select
sum(case when SFO.CHANGE_TYPE='TYPE_DD' then SFO.QTY END ) as qty1,
sum(case when SFO.CHANGE_TYPE ='TYPE_FF' then SFO.QTY END ) as qty2
from SN_FACT_ORDER_COST SFO)
select sum(decode(SFO.CHANGE_TYPE,'TYPE_DD',SFO.QTY,0)) "采购"
sum(decode(SFO.CHANGE_TYPE,'TYPE_FF',SFO.QTY,0)) "发放"
round((sum(decode(SFO.CHANGE_TYPE,'TYPE_DD',SFO.QTY,0))/
sum(decode(SFO.CHANGE_TYPE,'TYPE_FF',SFO.QTY,0)),2) "比例"
FROM SN_FACT_ORDER_COST SFO, SN_DIM_PART SDPI