25_city.sql 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --25、基站单站运行成本效益
  2. ---地市
  3. select
  4. t1.smonth as MONTH_ID,
  5. '地市' as ZB_TYPE,
  6. '河北' as PROV_NAME,
  7. t2.city_code*100 as CITY_ID,
  8. t1.sname as CITY_NAME,
  9. null as GRID_ID,
  10. null 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 '202206' as smonth,sname,stype,
  19. sum(column2+column3+column4+column5+column6+column7+column8+column9+column10+column11+column12+column13+column14+column15+column16+column17+column18) as cost_wuxian,
  20. sum(column19+column20+column21+column22+column23+column24+column25+column26) as cost_hexin,
  21. sum(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
  22. from sqmdb_cost.report50
  23. where sname in('石家庄_河北','唐山_河北','秦皇岛_河北','邯郸_河北','邢台_河北','保定_河北','张家口_河北','承德_河北','廊坊_河北','沧州_河北','衡水_河北','雄安_河北')
  24. and period_type='M' and smonth between '202201' and '202206' group by sname,stype) t1
  25. left join
  26. (select city_code,
  27. case when city_code=1301 then '石家庄_河北'
  28. when city_code=1302 then '唐山_河北'
  29. when city_code=1303 then '秦皇岛_河北'
  30. when city_code=1304 then '邯郸_河北'
  31. when city_code=1305 then '邢台_河北'
  32. when city_code=1306 then '保定_河北'
  33. when city_code=1307 then '张家口_河北'
  34. when city_code=1308 then '承德_河北'
  35. when city_code=1309 then '沧州_河北'
  36. when city_code=1310 then '廊坊_河北'
  37. when city_code=1311 then '衡水_河北'
  38. when city_code=1312 then '雄安_河北'
  39. else '' end as city_name,
  40. count(*) as site_count
  41. from (select distinct eqp_sid,city_code from sqmdb_cost.equip where profession ='移动无线') a
  42. group by city_code) t2
  43. on t1.sname=t2.city_name
  44. order by t2.city_code