sel indexId,item,value01,value02,value03
from
(
sel '7' indexId
,'新增通话用户三比' item
,a.value03 value01
,b.value03 value02
,case when b.value03 = 0.00 then 0.00
else a.value03-b.value03
end as value03
from
(
sel
zeroifnull(sum(new_user_cnt )) value01
,zeroifnull(sum(new_user_cnt ))
+zeroifnull(sum(unicom_gsm_new_user ))
+zeroifnull(sum(unicom_cdma_new_user ))
+zeroifnull(sum(phs_new_user_cnt )) value02
,case when value02=0 then 0.00
else
(100*1.00*value01)/value02
end value03
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id#
and city_code = #cityCode#
)a,
(
sel
zeroifnull(sum(new_user_cnt )) value01
,zeroifnull(sum(new_user_cnt ))
+zeroifnull(sum(unicom_gsm_new_user))
+zeroifnull(sum(unicom_cdma_new_user))
+zeroifnull(sum(phs_new_user_cnt)) value02
,100*1.00*(value01)/value02 value03
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id=#acyc_id_last_month#
and city_code = #cityCode#
)b
union all
sel '3' indexId
,'通话用户数' item
,a.value01 value01
,b.value01 value02
,case when b.value01=0 then 0.00
else 1.00*100*(a.value01-b.value01)/b.value01
end value03
from (
sel zeroifnull(sum(using_user_cnt)) value01
from dwpmvw.VW_fact_section_kpi_mon where acyc_id=#acyc_id#
and city_code = #cityCode#
) a,(
sel zeroifnull(sum(using_user_cnt)) value01
from dwpmvw.VW_fact_section_kpi_mon where acyc_id=#acyc_id_last_month#
and city_code = #cityCode#
) b
union all
sel '1' indexId
,'新增通话用户数' item
,a.value01 value01
,b.value01 value02
,case when b.value01=0 then 0.00
else (100*1.00*(a.value01-b.value01)/b.value01)
end as value03
from (
sel zeroifnull(sum(new_user_cnt)) value01
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id=#acyc_id#
and city_code = #cityCode#
) a,
(
sel zeroifnull(sum(new_user_cnt)) value01
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id=#acyc_id_last_month#
and city_code = #cityCode#
)b
union all
sel '2' indexId
,'净增通话用户数' item
,a.value01 value01
,b.value01 value02
,case when b.value01=0 then 0.00
else ( 100*1.00*(a.value01-b.value01)/b.value01)
end as value03
from
(
sel value01 from
(
sel a.value01-b.value01 value01 from
(
sel zeroifnull(sum(using_user_cnt)) value01 from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id#
and city_code = #cityCode#
) a,
(
sel zeroifnull(sum(using_user_cnt)) value01 from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id_last_month#
and city_code = #cityCode#
) b
)ff
)a,
(
sel value01 from
(
sel a.value01-b.value01 value01 from
(
sel zeroifnull(sum(using_user_cnt)) value01 from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id_last_month#
and city_code = #cityCode#
) a,
(
sel zeroifnull(sum(using_user_cnt)) value01 from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id_last_last_month#
and city_code = #cityCode#
) b
)ff
)b
union all
sel '4' indexId
,'通话时长' item
,a.value01 value01
,b.value01 value02
,case when b.value01=0 then 0
else (100*1.00*(a.value01-b.value01)/b.value01)
end as value03
from
(
sel zeroifnull(sum(times1)) value01
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id#
and city_code = #cityCode#
)a,
(
sel zeroifnull(sum(times1)) value01
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id_last_month#
and city_code = #cityCode#
)b
union all
sel '5' indexId
,'运营收入' item
,a.value01/100 value01
,b.value01/100 value02
,case when b.value01=0 then 0.00
else (100*1.00*(a.value01-b.value01)/b.value01)
end value03
from
(
sel zeroifnull(sum(fee_chrg)) value01
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id#
and city_code = #cityCode#
)a,
(
sel zeroifnull(sum(fee_chrg)) value01
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id = #acyc_id_last_month#
and city_code = #cityCode#
)b
union all
sel '6' indexId
,'通话用户三比' item
,a.value03 value01
,b.value03 value02
,case when b.value03 = 0.00 then 0.00
else 1.00*100*(a.value03-b.value03)/b.value03
end as value03
from
(
sel
zeroifnull(sum(using_user_cnt)) value01
,zeroifnull(sum(using_user_cnt))
+zeroifnull(sum(unicom_gsm_user_cnt))
+zeroifnull(sum(unicom_cdma_user_cnt))
+zeroifnull(sum(phs_user_cnt)) value02
,
case when value02=0 then 0.00
else
(100*1.00*value01)/value02
end value03
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id=#acyc_id#
and city_code = #cityCode#
)a,
(
sel
zeroifnull(sum(using_user_cnt)) value01
,zeroifnull(sum(using_user_cnt))
+zeroifnull(sum(unicom_gsm_user_cnt))
+zeroifnull(sum(unicom_cdma_user_cnt))
+zeroifnull(sum(phs_user_cnt)) value02
,(100*1.00*value01)/value02 value03
from dwpmvw.VW_fact_section_kpi_mon
where acyc_id=#acyc_id_last_month#
and city_code = #cityCode#
)b
)zz order by 1