05.sql 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. --05、百元资产网运成本(集团口径)表九
  2. ---北10
  3. select
  4. '202203' as smonth,
  5. a.sname,
  6. --a.stype,
  7. a.cost_total,b.zichan,
  8. a.cost_total/b.zichan*100 as cost_bai
  9. from
  10. (select sname,sum(column1)/10000 as cost_total from sqmdb_cost.report50
  11. where smonth between '202201' and '202203' and stype='分省展现' group by sname) a
  12. left join
  13. (select sname,(column7+column8)/2 as zichan from sqmdb_cost.report80054 where smonth='202203') b
  14. on a.sname=b.sname
  15. where a.sname in('北京','天津','河北','山西','内蒙古','辽宁','吉林','黑龙江','山东','河南')
  16. ---地市
  17. select
  18. '202203' as smonth,
  19. a.sname,
  20. --a.stype,
  21. a.cost_total,b.zichan,
  22. a.cost_total/b.zichan*100 as cost_bai
  23. from
  24. (select sname,sum(column1)/10000 as cost_total from sqmdb_cost.report50
  25. where smonth between '202201' and '202203' and stype='北方省汇总展现' group by sname) a
  26. left join
  27. (select sname,(column7+column8)/2 as zichan from sqmdb_cost.report80054 where smonth='202203') b
  28. on a.sname=b.sname
  29. where a.sname in('石家庄_河北','唐山_河北','秦皇岛_河北','邯郸_河北','邢台_河北','保定_河北','张家口_河北','承德_河北','廊坊_河北','沧州_河北','衡水_河北','雄安_河北')