123456789101112131415161718192021222324252627 |
- select
- '202207' as MONTH_ID,
- '地市' as ZB_TYPE,
- '河北' as PROV_NAME,
- c.city_code*100 as CITY_ID,
- a.sname as CITY_NAME,
- null as GRID_ID,
- null as GRID_NAME,
- '1' as ZB_CODE,
- '网运成本占收比(集团口径)' as ZB_NAME,
- '是' as IS_RATIO,
- a.cost_total as QZ_FZ,
- b.income_year as QZ_FM,--本年收入累计,
- case when b.income_year=0 then null else a.cost_total/b.income_year end as BY_QZ
- from
- (select sname,
- sum(column1)/10000 as cost_total--成本合计(包含人工)
- from sqmdb_cost.report50 where period_type='M' and smonth between '202201' and '202207' group by sname) a
- left join
- (select report_id,smonth,sname,stype,column4 as income_year from sqmdb_cost.report80040
- where period_type='M' and smonth='202207') b
- on a.sname=b.sname
- left join
- (select distinct city_code,city_pro from sqmdb_cost.dict_grid) c
- on a.sname=c.city_pro
- where a.sname in ('石家庄_河北','唐山_河北','秦皇岛_河北','邯郸_河北','邢台_河北','保定_河北','张家口_河北','承德_河北','廊坊_河北','沧州_河北','衡水_河北','雄安_河北')
- order by c.city_code
|