chengben_other_4_grid.sql 671 B

1234567891011121314151617181920
  1. ---Íø¸ñ
  2. ---chengben_other_4_grid_202203.csv
  3. select
  4. grid.smonth as sdate,
  5. grid.city_name as city_operator,
  6. grid.area_tower as area_operator,
  7. grid.tower_cost as tower_cost_total,
  8. grid.tower_num_avg as tower_num,
  9. grid.tower_cost_avg as tower_cost_avg_area,
  10. dg1.city_code*100 as city_code,
  11. dg2.area_code
  12. from sqmdb_cost.rpt_tower_cost_grid grid
  13. left join
  14. (select distinct city_code,city_sname from sqmdb_cost.dict_grid) dg1
  15. on grid.city_name=dg1.city_sname
  16. left join
  17. (select distinct city_sname,area_code,area_tower from sqmdb_cost.dict_grid) dg2
  18. on grid.city_name=dg2.city_sname and grid.area_tower=dg2.area_tower
  19. where smonth='202204'
  20. order by dg1.city_code,dg2.area_code