04_city.sql 725 B

12345678910111213141516171819202122232425
  1. --04、网运成本预算完成进度(省内口径)
  2. select
  3. cs.smonth as MONTH_ID,
  4. '地市' as ZB_TYPE,
  5. '河北' as PROV_NAME,
  6. dg.city_code*100 as CITY_ID,
  7. dg.city_sname as CITY_NAME,
  8. null as GRID_ID,
  9. null as GRID_NAME,
  10. '4' as ZB_CODE,
  11. '网运成本预算完成进度(省内口径)' as ZB_NAME,
  12. '是' as IS_RATIO,
  13. cs.cost_total as QZ_FZ,
  14. ys.total_ys as QZ_FM,
  15. cs.cost_total/ys.total_ys as BY_QZ
  16. from
  17. (select smonth,sname,cost_total from sqmdb_cost.chengben_shengnei where stype='地市' and smonth='202207') cs
  18. join
  19. (select city_name||'_河北' as city_name,total_ys from sqmdb_cost.yusuan_shengnei) ys
  20. on cs.sname=ys.city_name
  21. join
  22. (select distinct city_code,city_pro,city_sname from sqmdb_cost.dict_grid) dg
  23. on cs.sname=dg.city_pro
  24. order by dg.city_code