1234567891011121314151617181920212223242526272829 |
- --19、无线成本占收比
- ---地市
- select
- a.smonth as MONTH_ID,
- '地市' as ZB_TYPE,
- '河北' as PROV_NAME,
- dg.city_code*100 as CITY_ID,
- a.sname as CITY_NAME,
- null as GRID_ID,
- null as GRID_NAME,
- '19' as ZB_CODE,
- '无线成本占收比' as ZB_NAME,
- '是' as IS_RATIO,
- a.cost_wireless as QZ_FZ,
- b.income_year as QZ_FM,
- case when b.income_year=0 then null else a.cost_wireless/b.income_year end as BY_QZ
- from
- (select '202206' as smonth,sname,
- sum(column2+column3+column4+column5+column6+column7+column8+column9+column10+column11+column12+column13+column14+column15+column16+column17)/10000 as cost_wireless --column18 账面人工成本
- from sqmdb_cost.report50 where period_type='M' and stype ='北方省汇总展现'
- and smonth between '202201' and '202206' group by sname) a
- left join
- (select report_id,smonth,sname,stype,column4 as income_year from sqmdb_cost.report80040 where smonth='202206') b
- on a.sname=b.sname
- join
- (select distinct city_code,city_pro from sqmdb_cost.dict_grid) dg
- on a.sname=dg.city_pro
- where a.sname in ('石家庄_河北','唐山_河北','秦皇岛_河北','邯郸_河北','邢台_河北','保定_河北','张家口_河北','承德_河北','廊坊_河北','沧州_河北','衡水_河北','雄安_河北')
- order by dg.city_code
|