|
@@ -0,0 +1,512 @@
|
|
|
|
+with err_tw as(
|
|
|
|
+select
|
|
|
|
+t1.smonth as month_id,--账期
|
|
|
|
+dz.area_id as area_id,--区域
|
|
|
|
+coalesce(dz.area_name, dcg.grid_name) as area_name,--区域名称
|
|
|
|
+coalesce(dz.p_id, dcg.city_code*100) as p_id,--父ID
|
|
|
|
+'1' as idx_id,--指标ID
|
|
|
|
+'铁塔租赁费异常指标' as idx_name,--指标名称
|
|
|
|
+t1.level_type as idx_level,--指标分级
|
|
|
|
+t1.total_num as idx_val_tot,--指标值-总
|
|
|
|
+t1.level_num::numeric as idx_val_err,--指标值-异常
|
|
|
|
+dcg.city_name as p_name--地市名称,用于汇聚地市指标
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,total_num,
|
|
|
|
+regexp_split_to_table(concat_ws('~','<1.5倍','1.5-2倍','2倍以上'),'~') level_type,
|
|
|
|
+regexp_split_to_table(concat_ws('~',level_1_num,level_2_num,level_3_num),'~') level_num
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when over_tower_cost_grid<1.5 then 1 else 0 end) as level_1_num,
|
|
|
|
+sum(case when over_tower_cost_grid>=1.5 and over_tower_cost_grid<=2 then 1 else 0 end) as level_2_num,
|
|
|
|
+sum(case when over_tower_cost_grid>2 then 1 else 0 end) as level_3_num
|
|
|
|
+from sqmdb_cost.rpt_baobiao_4_cgzf
|
|
|
|
+where tower_cost is not null
|
|
|
|
+and tower_cost_grid is not null
|
|
|
|
+and smonth='202205'
|
|
|
|
+group by smonth,grid_code) a) t1
|
|
|
|
+join sqmdb_cost.dict_code_grid dcg on t1.grid_code=dcg.grid_code
|
|
|
|
+left join sqmdb_cost.dict_zzjg dz on dcg.area_code=dz.area_id),
|
|
|
|
+
|
|
|
|
+err_3rd as (
|
|
|
|
+select
|
|
|
|
+t1.smonth as month_id,--账期
|
|
|
|
+dz.area_id as area_id,--区域
|
|
|
|
+coalesce(dz.area_name, dcg.grid_name) as area_name,--区域名称
|
|
|
|
+coalesce(dz.p_id, dcg.city_code*100) as p_id,--父ID
|
|
|
|
+'2' as idx_id,--指标ID
|
|
|
|
+'三方租赁费异常指标' as idx_name,--指标名称
|
|
|
|
+t1.level_type as idx_level,--指标分级
|
|
|
|
+t1.total_num as idx_val_tot,--指标值-总
|
|
|
|
+t1.level_num::numeric as idx_val_err,--指标值-异常
|
|
|
|
+dcg.city_name as p_name--地市名称,用于汇聚地市指标
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,total_num,
|
|
|
|
+regexp_split_to_table(concat_ws('~','<1.5倍','1.5-2倍','2倍以上'),'~') level_type,
|
|
|
|
+regexp_split_to_table(concat_ws('~',level_1_num,level_2_num,level_3_num),'~') level_num
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when ht_cost_grid_scene_bs<1.5 then 1 else 0 end) as level_1_num,
|
|
|
|
+sum(case when ht_cost_grid_scene_bs>=1.5 and ht_cost_grid_scene_bs<=2 then 1 else 0 end) as level_2_num,
|
|
|
|
+sum(case when ht_cost_grid_scene_bs>2 then 1 else 0 end) as level_3_num
|
|
|
|
+from sqmdb_cost.rpt_baobiao_4_cgzf
|
|
|
|
+where hetong_sid is not null and smonth='202205'
|
|
|
|
+group by smonth,grid_code) a) t1
|
|
|
|
+join sqmdb_cost.dict_code_grid dcg on t1.grid_code=dcg.grid_code
|
|
|
|
+left join sqmdb_cost.dict_zzjg dz on dcg.area_code=dz.area_id),
|
|
|
|
+
|
|
|
|
+err_zgd as (
|
|
|
|
+select
|
|
|
|
+t1.smonth as month_id ,--账期
|
|
|
|
+dz.area_id as area_id,--区域
|
|
|
|
+coalesce(dz.area_name, dcg.grid_name) as area_name,--区域名称
|
|
|
|
+coalesce(dz.p_id, dcg.city_code*100) as p_id,--父ID
|
|
|
|
+'3' as idx_id,--指标ID
|
|
|
|
+'转供电异常指标' as idx_name,--指标名称
|
|
|
|
+t1.level_type as idx_level,--指标分级
|
|
|
|
+t1.total_num as idx_val_tot,--指标值-总
|
|
|
|
+t1.level_num::numeric as idx_val_err,--指标值-异常
|
|
|
|
+dcg.city_name as p_name--地市名称,用于汇聚地市指标
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,total_num,
|
|
|
|
+regexp_split_to_table(concat_ws('~','8毛以下','8毛-1块','1块以上'),'~') level_type,
|
|
|
|
+regexp_split_to_table(concat_ws('~',level_1_num,level_2_num,level_3_num),'~') level_num
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when eprice<0.8 then 1 else 0 end) as level_1_num,
|
|
|
|
+sum(case when eprice>=0.8 and eprice<=1 then 1 else 0 end) as level_2_num,
|
|
|
|
+sum(case when eprice>1 then 1 else 0 end) as level_3_num
|
|
|
|
+from sqmdb_cost.rpt_baobiao_5_cgdf
|
|
|
|
+where smonth='202205'
|
|
|
|
+group by smonth,grid_code) a) t1
|
|
|
|
+join sqmdb_cost.dict_code_grid dcg on t1.grid_code=dcg.grid_code
|
|
|
|
+left join sqmdb_cost.dict_zzjg dz on dcg.area_code=dz.area_id),
|
|
|
|
+
|
|
|
|
+err_nh as (
|
|
|
|
+select
|
|
|
|
+t1.smonth as month_id ,--账期
|
|
|
|
+dz.area_id as area_id,--区域
|
|
|
|
+coalesce(dz.area_name, dcg.grid_name) as area_name,--区域名称
|
|
|
|
+coalesce(dz.p_id, dcg.city_code*100) as p_id,--父ID
|
|
|
|
+'4' as idx_id,--指标ID
|
|
|
|
+'能耗异常指标' as idx_name,--指标名称
|
|
|
|
+t1.level_type as idx_level,--指标分级
|
|
|
|
+t1.total_num as idx_val_tot,--指标值-总
|
|
|
|
+t1.level_num::numeric as idx_val_err,--指标值-异常
|
|
|
|
+dcg.city_name as p_name--地市名称,用于汇聚地市指标
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,total_num,
|
|
|
|
+regexp_split_to_table(concat_ws('~','<1.5倍','1.5-2倍','2倍以上'),'~') level_type,
|
|
|
|
+regexp_split_to_table(concat_ws('~',level_1_num,level_2_num,level_3_num),'~') level_num
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when over_lilun_power<1.5 then 1 else 0 end) as level_1_num,
|
|
|
|
+sum(case when over_lilun_power>=1.5 and over_lilun_power<=2 then 1 else 0 end) as level_2_num,
|
|
|
|
+sum(case when over_lilun_power>2 then 1 else 0 end) as level_3_num
|
|
|
|
+from sqmdb_cost.rpt_baobiao_6_cgnh
|
|
|
|
+where smonth='202205'
|
|
|
|
+group by smonth,grid_code) a) t1
|
|
|
|
+join sqmdb_cost.dict_code_grid dcg on t1.grid_code=dcg.grid_code
|
|
|
|
+left join sqmdb_cost.dict_zzjg dz on dcg.area_code=dz.area_id),
|
|
|
|
+
|
|
|
|
+--有合同无局站
|
|
|
|
+check_ht as (
|
|
|
|
+select
|
|
|
|
+t1.smonth as month_id ,--账期
|
|
|
|
+dz.area_id as area_id,--区域
|
|
|
|
+coalesce(dz.area_name, dcg.grid_name) as area_name,--区域名称
|
|
|
|
+coalesce(dz.p_id, dcg.city_code*100) as p_id,--父ID
|
|
|
|
+'5' as idx_id,--指标ID
|
|
|
|
+'有合同无局站' as idx_name,--指标名称
|
|
|
|
+t1.level_type as idx_level,--指标分级
|
|
|
|
+t1.total_num as idx_val_tot,--指标值-总
|
|
|
|
+t1.level_num::numeric as idx_val_err,--指标值-异常
|
|
|
|
+dcg.city_name as p_name--地市名称,用于汇聚地市指标
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,total_num,
|
|
|
|
+regexp_split_to_table(concat_ws('~','有合同有局站','有合同无局站'),'~') level_type,
|
|
|
|
+regexp_split_to_table(concat_ws('~',has_num,no_num),'~') level_num
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when stype='有合同有局站' then 1 else 0 end) as has_num,
|
|
|
|
+sum(case when stype!='有合同有局站' then 1 else 0 end) as no_num
|
|
|
|
+from sqmdb_cost.err_has_ht_no_station
|
|
|
|
+group by smonth,grid_code) a) t1
|
|
|
|
+join sqmdb_cost.dict_code_grid dcg on t1.grid_code=dcg.grid_code
|
|
|
|
+left join sqmdb_cost.dict_zzjg dz on dcg.area_code=dz.area_id),
|
|
|
|
+
|
|
|
|
+--有能耗无局站
|
|
|
|
+check_nh as (
|
|
|
|
+select
|
|
|
|
+t1.smonth as month_id ,--账期
|
|
|
|
+dz.area_id as area_id,--区域
|
|
|
|
+coalesce(dz.area_name, dcg.grid_name) as area_name,--区域名称
|
|
|
|
+coalesce(dz.p_id, dcg.city_code*100) as p_id,--父ID
|
|
|
|
+'6' as idx_id,--指标ID
|
|
|
|
+'有能耗无局站' as idx_name,--指标名称
|
|
|
|
+t1.level_type as idx_level,--指标分级
|
|
|
|
+t1.total_num as idx_val_tot,--指标值-总
|
|
|
|
+t1.level_num::numeric as idx_val_err,--指标值-异常
|
|
|
|
+dcg.city_name as p_name--地市名称,用于汇聚地市指标
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,total_num,
|
|
|
|
+regexp_split_to_table(concat_ws('~','有能耗有局站','有能耗无局站'),'~') level_type,
|
|
|
|
+regexp_split_to_table(concat_ws('~',has_num,no_num),'~') level_num
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when stype='校验正常' then 1 else 0 end) as has_num,
|
|
|
|
+sum(case when stype!='校验正常' then 1 else 0 end) as no_num
|
|
|
|
+from sqmdb_cost.err_has_nh_no_station
|
|
|
|
+group by smonth,grid_code) a) t1
|
|
|
|
+join sqmdb_cost.dict_code_grid dcg on t1.grid_code=dcg.grid_code
|
|
|
|
+left join sqmdb_cost.dict_zzjg dz on dcg.area_code=dz.area_id),
|
|
|
|
+
|
|
|
|
+--有铁塔订单无局站
|
|
|
|
+check_tw as (
|
|
|
|
+select
|
|
|
|
+t1.smonth as month_id,--账期
|
|
|
|
+dz.area_id as area_id,--区域
|
|
|
|
+coalesce(dz.area_name, dcg.grid_name) as area_name,--区域名称
|
|
|
|
+coalesce(dz.p_id, dcg.city_code*100) as p_id,--父ID
|
|
|
|
+'7' as idx_id,--指标ID
|
|
|
|
+'有铁塔订单无局站' as idx_name,--指标名称
|
|
|
|
+t1.level_type as idx_level,--指标分级
|
|
|
|
+t1.total_num as idx_val_tot,--指标值-总
|
|
|
|
+t1.level_num::numeric as idx_val_err,--指标值-异常
|
|
|
|
+dcg.city_name as p_name--地市名称,用于汇聚地市指标
|
|
|
|
+from (select
|
|
|
|
+smonth,grid_code,total_num,
|
|
|
|
+regexp_split_to_table(concat_ws('~','有铁塔订单有局站','有铁塔订单无局站'),'~') level_type,
|
|
|
|
+regexp_split_to_table(concat_ws('~',has_num,no_num),'~') level_num
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when stype='有铁塔订单有局站' then 1 else 0 end) as has_num,
|
|
|
|
+sum(case when stype!='有铁塔订单有局站' then 1 else 0 end) as no_num
|
|
|
|
+from sqmdb_cost.err_has_tw_no_station
|
|
|
|
+group by smonth,grid_code) a) t1
|
|
|
|
+join sqmdb_cost.dict_code_grid dcg on t1.grid_code=dcg.grid_code
|
|
|
|
+left join sqmdb_cost.dict_zzjg dz on dcg.area_code=dz.area_id),
|
|
|
|
+
|
|
|
|
+--无成本中心数据
|
|
|
|
+missing_cbzx as (select
|
|
|
|
+t1.smonth as month_id ,--账期
|
|
|
|
+dz.area_id as area_id,--区域
|
|
|
|
+coalesce(dz.area_name, dcg.grid_name) as area_name,--区域名称
|
|
|
|
+coalesce(dz.p_id, dcg.city_code*100) as p_id,--父ID
|
|
|
|
+'8' as idx_id,--指标ID
|
|
|
|
+'无成本中心数据' as idx_name,--指标名称
|
|
|
|
+t1.level_type as idx_level,--指标分级
|
|
|
|
+t1.total_num as idx_val_tot,--指标值-总
|
|
|
|
+t1.level_num::numeric as idx_val_err,--指标值-异常
|
|
|
|
+dcg.city_name as p_name--地市名称,用于汇聚地市指标
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,total_num,
|
|
|
|
+regexp_split_to_table(concat_ws('~','有成本中心','无成本中心'),'~') level_type,
|
|
|
|
+regexp_split_to_table(concat_ws('~',has_num,no_num),'~') level_num
|
|
|
|
+from
|
|
|
|
+(select smonth,grid_code,
|
|
|
|
+sum(total_num) as total_num,
|
|
|
|
+sum(has_num) as has_num,
|
|
|
|
+sum(no_num) as no_num
|
|
|
|
+from
|
|
|
|
+(select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when cbzx is not null then 1 else 0 end) as has_num,
|
|
|
|
+sum(case when cbzx is null then 1 else 0 end) as no_num
|
|
|
|
+from sqmdb_cost.err_has_ht_no_station
|
|
|
|
+group by smonth,grid_code
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when cost_unit_name is not null then 1 else 0 end) as has_num,
|
|
|
|
+sum(case when cost_unit_name is null then 1 else 0 end) as no_num
|
|
|
|
+from sqmdb_cost.err_has_nh_no_station
|
|
|
|
+group by smonth,grid_code
|
|
|
|
+union all
|
|
|
|
+select
|
|
|
|
+smonth,grid_code,
|
|
|
|
+count(*) as total_num,
|
|
|
|
+sum(case when cbzx is not null then 1 else 0 end) as has_num,
|
|
|
|
+sum(case when cbzx is null then 1 else 0 end) as no_num
|
|
|
|
+from sqmdb_cost.err_has_tw_no_station
|
|
|
|
+group by smonth,grid_code) u
|
|
|
|
+group by smonth,grid_code) a) t1
|
|
|
|
+join sqmdb_cost.dict_code_grid dcg on t1.grid_code=dcg.grid_code
|
|
|
|
+left join sqmdb_cost.dict_zzjg dz on dcg.area_code=dz.area_id)
|
|
|
|
+
|
|
|
|
+--铁塔租赁费异常指标-网格
|
|
|
|
+select
|
|
|
|
+month_id as "MONTH_ID",
|
|
|
|
+area_id as "AREA_ID",
|
|
|
|
+area_name as "AREA_NAME",
|
|
|
|
+p_id as "P_ID",
|
|
|
|
+idx_id as "IDX_ID",
|
|
|
|
+idx_name as "IDX_NAME",
|
|
|
|
+idx_level as "IDX_LEVEL",
|
|
|
|
+idx_val_tot as "IDX_VAL_TOT",
|
|
|
|
+idx_val_err as "IDX_VAL_ERR"
|
|
|
|
+from err_tw
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--铁塔租赁费异常指标-地市
|
|
|
|
+select
|
|
|
|
+c.month_id as "MONTH_ID",
|
|
|
|
+c.p_id as "AREA_ID",
|
|
|
|
+c.p_name as "AREA_NAME",
|
|
|
|
+z.p_id as "P_ID",
|
|
|
|
+c.idx_id as "IDX_ID",
|
|
|
|
+c.idx_name as "IDX_NAME",
|
|
|
|
+c.idx_level as "IDX_LEVEL",
|
|
|
|
+sum(c.idx_val_tot) as "IDX_VAL_TOT",
|
|
|
|
+sum(c.idx_val_err) as "IDX_VAL_ERR"
|
|
|
|
+from err_tw c
|
|
|
|
+left join sqmdb_cost.dict_zzjg z on c.p_id=z.area_id
|
|
|
|
+group by c.month_id,c.p_id,z.p_id,c.p_name,c.idx_id,c.idx_name,c.idx_level
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--三方租赁费异常指标-网格
|
|
|
|
+select
|
|
|
|
+month_id as "MONTH_ID",
|
|
|
|
+area_id as "AREA_ID",
|
|
|
|
+area_name as "AREA_NAME",
|
|
|
|
+p_id as "P_ID",
|
|
|
|
+idx_id as "IDX_ID",
|
|
|
|
+idx_name as "IDX_NAME",
|
|
|
|
+idx_level as "IDX_LEVEL",
|
|
|
|
+idx_val_tot as "IDX_VAL_TOT",
|
|
|
|
+idx_val_err as "IDX_VAL_ERR"
|
|
|
|
+from err_3rd
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--三方租赁费异常指标-地市
|
|
|
|
+select
|
|
|
|
+c.month_id as "MONTH_ID",
|
|
|
|
+c.p_id as "AREA_ID",
|
|
|
|
+c.p_name as "AREA_NAME",
|
|
|
|
+z.p_id as "P_ID",
|
|
|
|
+c.idx_id as "IDX_ID",
|
|
|
|
+c.idx_name as "IDX_NAME",
|
|
|
|
+c.idx_level as "IDX_LEVEL",
|
|
|
|
+sum(c.idx_val_tot) as "IDX_VAL_TOT",
|
|
|
|
+sum(c.idx_val_err) as "IDX_VAL_ERR"
|
|
|
|
+from err_3rd c
|
|
|
|
+left join sqmdb_cost.dict_zzjg z on c.p_id=z.area_id
|
|
|
|
+group by c.month_id,c.p_id,z.p_id,c.p_name,c.idx_id,c.idx_name,c.idx_level
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--转供电异常指标-网格
|
|
|
|
+select
|
|
|
|
+month_id as "MONTH_ID",
|
|
|
|
+area_id as "AREA_ID",
|
|
|
|
+area_name as "AREA_NAME",
|
|
|
|
+p_id as "P_ID",
|
|
|
|
+idx_id as "IDX_ID",
|
|
|
|
+idx_name as "IDX_NAME",
|
|
|
|
+idx_level as "IDX_LEVEL",
|
|
|
|
+idx_val_tot as "IDX_VAL_TOT",
|
|
|
|
+idx_val_err as "IDX_VAL_ERR"
|
|
|
|
+from err_zgd
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--转供电异常指标-地市
|
|
|
|
+select
|
|
|
|
+c.month_id as "MONTH_ID",
|
|
|
|
+c.p_id as "AREA_ID",
|
|
|
|
+c.p_name as "AREA_NAME",
|
|
|
|
+z.p_id as "P_ID",
|
|
|
|
+c.idx_id as "IDX_ID",
|
|
|
|
+c.idx_name as "IDX_NAME",
|
|
|
|
+c.idx_level as "IDX_LEVEL",
|
|
|
|
+sum(c.idx_val_tot) as "IDX_VAL_TOT",
|
|
|
|
+sum(c.idx_val_err) as "IDX_VAL_ERR"
|
|
|
|
+from err_zgd c
|
|
|
|
+left join sqmdb_cost.dict_zzjg z on c.p_id=z.area_id
|
|
|
|
+group by c.month_id,c.p_id,z.p_id,c.p_name,c.idx_id,c.idx_name,c.idx_level
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--能耗异常指标-网格
|
|
|
|
+select
|
|
|
|
+month_id as "MONTH_ID",
|
|
|
|
+area_id as "AREA_ID",
|
|
|
|
+area_name as "AREA_NAME",
|
|
|
|
+p_id as "P_ID",
|
|
|
|
+idx_id as "IDX_ID",
|
|
|
|
+idx_name as "IDX_NAME",
|
|
|
|
+idx_level as "IDX_LEVEL",
|
|
|
|
+idx_val_tot as "IDX_VAL_TOT",
|
|
|
|
+idx_val_err as "IDX_VAL_ERR"
|
|
|
|
+from err_nh
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--能耗异常指标-地市
|
|
|
|
+select
|
|
|
|
+c.month_id as "MONTH_ID",
|
|
|
|
+c.p_id as "AREA_ID",
|
|
|
|
+c.p_name as "AREA_NAME",
|
|
|
|
+z.p_id as "P_ID",
|
|
|
|
+c.idx_id as "IDX_ID",
|
|
|
|
+c.idx_name as "IDX_NAME",
|
|
|
|
+c.idx_level as "IDX_LEVEL",
|
|
|
|
+sum(c.idx_val_tot) as "IDX_VAL_TOT",
|
|
|
|
+sum(c.idx_val_err) as "IDX_VAL_ERR"
|
|
|
|
+from err_nh c
|
|
|
|
+left join sqmdb_cost.dict_zzjg z on c.p_id=z.area_id
|
|
|
|
+group by c.month_id,c.p_id,z.p_id,c.p_name,c.idx_id,c.idx_name,c.idx_level
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--有合同无局站-网格
|
|
|
|
+select
|
|
|
|
+month_id as "MONTH_ID",
|
|
|
|
+area_id as "AREA_ID",
|
|
|
|
+area_name as "AREA_NAME",
|
|
|
|
+p_id as "P_ID",
|
|
|
|
+idx_id as "IDX_ID",
|
|
|
|
+idx_name as "IDX_NAME",
|
|
|
|
+idx_level as "IDX_LEVEL",
|
|
|
|
+idx_val_tot as "IDX_VAL_TOT",
|
|
|
|
+idx_val_err as "IDX_VAL_ERR"
|
|
|
|
+from check_ht
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--有合同无局站-地市
|
|
|
|
+select
|
|
|
|
+c.month_id as "MONTH_ID",
|
|
|
|
+c.p_id as "AREA_ID",
|
|
|
|
+c.p_name as "AREA_NAME",
|
|
|
|
+z.p_id as "P_ID",
|
|
|
|
+c.idx_id as "IDX_ID",
|
|
|
|
+c.idx_name as "IDX_NAME",
|
|
|
|
+c.idx_level as "IDX_LEVEL",
|
|
|
|
+sum(c.idx_val_tot) as "IDX_VAL_TOT",
|
|
|
|
+sum(c.idx_val_err) as "IDX_VAL_ERR"
|
|
|
|
+from check_ht c
|
|
|
|
+left join sqmdb_cost.dict_zzjg z on c.p_id=z.area_id
|
|
|
|
+group by c.month_id,c.p_id,z.p_id,c.p_name,c.idx_id,c.idx_name,c.idx_level
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--有能耗无局站-网格
|
|
|
|
+select
|
|
|
|
+month_id as "MONTH_ID",
|
|
|
|
+area_id as "AREA_ID",
|
|
|
|
+area_name as "AREA_NAME",
|
|
|
|
+p_id as "P_ID",
|
|
|
|
+idx_id as "IDX_ID",
|
|
|
|
+idx_name as "IDX_NAME",
|
|
|
|
+idx_level as "IDX_LEVEL",
|
|
|
|
+idx_val_tot as "IDX_VAL_TOT",
|
|
|
|
+idx_val_err as "IDX_VAL_ERR"
|
|
|
|
+from check_nh
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--有能耗无局站-地市
|
|
|
|
+select
|
|
|
|
+c.month_id as "MONTH_ID",
|
|
|
|
+c.p_id as "AREA_ID",
|
|
|
|
+c.p_name as "AREA_NAME",
|
|
|
|
+z.p_id as "P_ID",
|
|
|
|
+c.idx_id as "IDX_ID",
|
|
|
|
+c.idx_name as "IDX_NAME",
|
|
|
|
+c.idx_level as "IDX_LEVEL",
|
|
|
|
+sum(c.idx_val_tot) as "IDX_VAL_TOT",
|
|
|
|
+sum(c.idx_val_err) as "IDX_VAL_ERR"
|
|
|
|
+from check_nh c
|
|
|
|
+left join sqmdb_cost.dict_zzjg z on c.p_id=z.area_id
|
|
|
|
+group by c.month_id,c.p_id,z.p_id,c.p_name,c.idx_id,c.idx_name,c.idx_level
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--有铁塔订单无局站-网格
|
|
|
|
+select
|
|
|
|
+month_id as "MONTH_ID",
|
|
|
|
+area_id as "AREA_ID",
|
|
|
|
+area_name as "AREA_NAME",
|
|
|
|
+p_id as "P_ID",
|
|
|
|
+idx_id as "IDX_ID",
|
|
|
|
+idx_name as "IDX_NAME",
|
|
|
|
+idx_level as "IDX_LEVEL",
|
|
|
|
+idx_val_tot as "IDX_VAL_TOT",
|
|
|
|
+idx_val_err as "IDX_VAL_ERR"
|
|
|
|
+from check_tw
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--有铁塔订单无局站-地市
|
|
|
|
+select
|
|
|
|
+c.month_id as "MONTH_ID",
|
|
|
|
+c.p_id as "AREA_ID",
|
|
|
|
+c.p_name as "AREA_NAME",
|
|
|
|
+z.p_id as "P_ID",
|
|
|
|
+c.idx_id as "IDX_ID",
|
|
|
|
+c.idx_name as "IDX_NAME",
|
|
|
|
+c.idx_level as "IDX_LEVEL",
|
|
|
|
+sum(c.idx_val_tot) as "IDX_VAL_TOT",
|
|
|
|
+sum(c.idx_val_err) as "IDX_VAL_ERR"
|
|
|
|
+from check_tw c
|
|
|
|
+left join sqmdb_cost.dict_zzjg z on c.p_id=z.area_id
|
|
|
|
+group by c.month_id,c.p_id,z.p_id,c.p_name,c.idx_id,c.idx_name,c.idx_level
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--无成本中心数据-网格
|
|
|
|
+select
|
|
|
|
+month_id as "MONTH_ID",
|
|
|
|
+area_id as "AREA_ID",
|
|
|
|
+area_name as "AREA_NAME",
|
|
|
|
+p_id as "P_ID",
|
|
|
|
+idx_id as "IDX_ID",
|
|
|
|
+idx_name as "IDX_NAME",
|
|
|
|
+idx_level as "IDX_LEVEL",
|
|
|
|
+idx_val_tot as "IDX_VAL_TOT",
|
|
|
|
+idx_val_err as "IDX_VAL_ERR"
|
|
|
|
+from missing_cbzx
|
|
|
|
+
|
|
|
|
+union all
|
|
|
|
+
|
|
|
|
+--无成本中心数据-地市
|
|
|
|
+select
|
|
|
|
+c.month_id as "MONTH_ID",
|
|
|
|
+c.p_id as "AREA_ID",
|
|
|
|
+c.p_name as "AREA_NAME",
|
|
|
|
+z.p_id as "P_ID",
|
|
|
|
+c.idx_id as "IDX_ID",
|
|
|
|
+c.idx_name as "IDX_NAME",
|
|
|
|
+c.idx_level as "IDX_LEVEL",
|
|
|
|
+sum(c.idx_val_tot) as "IDX_VAL_TOT",
|
|
|
|
+sum(c.idx_val_err) as "IDX_VAL_ERR"
|
|
|
|
+from missing_cbzx c
|
|
|
|
+left join sqmdb_cost.dict_zzjg z on c.p_id=z.area_id
|
|
|
|
+group by c.month_id,c.p_id,z.p_id,c.p_name,c.idx_id,c.idx_name,c.idx_level
|
|
|
|
+
|