25_grid.sql 1.6 KB

1234567891011121314151617181920212223242526272829303132
  1. --25、基站单站运行成本效益
  2. ---网格
  3. select
  4. t1.smonth as MONTH_ID,
  5. '网格' as ZB_TYPE,
  6. '河北' as PROV_NAME,
  7. t1.city_code*100 as CITY_ID,
  8. t1.city_name as CITY_NAME,
  9. t1.grid_code as GRID_ID,
  10. t1.grid_name as GRID_NAME,
  11. '25' as ZB_CODE,
  12. '基站单站运行成本效益' as ZB_NAME,
  13. '否' as IS_RATIO,
  14. t1.cost_wuxian_hexin as QZ_FZ,
  15. t2.site_count as QZ_FM,
  16. t1.cost_wuxian_hexin/t2.site_count/6 as BY_QZ
  17. from
  18. (select fz.smonth,dcg.city_code,dcg.area_code,dcg.grid_code,dcg.city_name,fz.grid_name,fz.cost_wuxian,fz.cost_hexin,fz.cost_wuxian_hexin from
  19. (select smonth,city_name,grid_name,
  20. (column2+column3+column4+column5+column6+column7+column8+column9+column10+column11+column12+column13+column14+column15+column16+column17+column18) as cost_wuxian,
  21. (column19+column20+column21+column22+column23+column24+column25+column26) as cost_hexin,
  22. (column2+column3+column4+column5+column6+column7+column8+column9+column10+column11+column12+column13+column14+column15+column16+column17+column18+column19+column20+column21+column22+column23+column24+column25+column26) as cost_wuxian_hexin
  23. from sqmdb_cost.report49
  24. where period_type='Y' and grid_name!='合计' and smonth='202206') fz
  25. join sqmdb_cost.dict_grid_code dgc on city_name_short(fz.city_name)=dgc.city_name and trim(fz.grid_name)=trim(dgc.grid_name)
  26. join sqmdb_cost.dict_code_grid dcg on dgc.grid_code=dcg.grid_code) t1
  27. join
  28. (select city_code,area_code,count(*) as site_count from
  29. (select distinct eqp_sid,city_code,area_code from sqmdb_cost.equip where profession ='移动无线') et
  30. group by city_code,area_code) t2
  31. on t1.city_code=t2.city_code and t1.area_code=t2.area_code
  32. order by t1.city_code