09.sql 1.0 KB

123456789101112131415161718192021222324
  1. --09、百元资产修理维护费
  2. ---北10
  3. select t1.smonth,t1.sname,t1.cost_fix,t2.zichan,
  4. (t1.cost_fix/t2.zichan)*100 as cost_bai_fix
  5. from
  6. (select smonth,stype,sname,cost_fix from sqmdb_cost.chengben_shengnei where smonth='202203' and stype='北10') t1
  7. join
  8. (select smonth,sname,stype,(column7+column8)/2 as zichan from sqmdb_cost.report80054 where period_type='M'
  9. and sname in('北京','天津','河北','山西','内蒙古','辽宁','吉林','黑龙江','山东','河南')
  10. and stype='分省展现'
  11. and smonth='202203') t2
  12. on t1.sname=t2.sname
  13. ---地市
  14. select t1.smonth,t1.sname,t1.cost_fix,t2.zichan,
  15. (t1.cost_fix/t2.zichan)*100 as cost_bai_fix
  16. from
  17. (select smonth,stype,sname,cost_fix from sqmdb_cost.chengben_shengnei where smonth='202203' and stype='地市') t1
  18. join
  19. (select smonth,sname,stype,(column7+column8)/2 as zichan from sqmdb_cost.report80054 where period_type='M'
  20. and sname in('石家庄_河北','唐山_河北','秦皇岛_河北','邯郸_河北','邢台_河北','保定_河北','张家口_河北','承德_河北','廊坊_河北','沧州_河北','衡水_河北','雄安_河北')
  21. and smonth='202203') t2
  22. on t1.sname=t2.sname