07_b10.sql 1.0 KB

12345678910111213141516171819202122232425262728
  1. --07、百元净资产网运成本
  2. ---北10
  3. select
  4. '202206' as MONTH_ID,
  5. '北10' as ZB_TYPE,
  6. a.sname as PROV_NAME,
  7. null as CITY_ID,
  8. null as CITY_NAME,
  9. null as GRID_ID,
  10. null as GRID_NAME,
  11. '7' as ZB_CODE,
  12. '百元净资产网运成本' as ZB_NAME,
  13. '否' as IS_RATIO,
  14. c.cost_total as QZ_FZ,
  15. a.zichan-b.zhejiu as QZ_FM,
  16. c.cost_total/(a.zichan-b.zhejiu)*100 as BY_QZ
  17. from
  18. (select sname,stype,sum(column7+column8)/2 as zichan
  19. from sqmdb_cost.report80054 where period_type='M' and smonth between '202201' and '202206' group by sname,stype) a
  20. left join
  21. (select sname,stype,sum(column16) as zhejiu
  22. from sqmdb_cost.report80053 where period_type='M' and smonth between '202201' and '202206' group by sname,stype) b
  23. on a.sname=b.sname and a.stype=b.stype
  24. left join
  25. (select sname,stype,sum(column1)/10000 as cost_total
  26. from sqmdb_cost.report50 where period_type='M' and smonth between '202201' and '202206' group by sname,stype) c
  27. on a.sname=c.sname and a.stype=c.stype
  28. where a.sname in('北京','天津','河北','山西','内蒙古','辽宁','吉林','黑龙江','山东','河南')