chengben_exception_3_grid.sql 681 B

12345678910111213141516171819
  1. --局站能耗
  2. --(chengben_exception_3_grid_202203.csv)
  3. select
  4. distinct
  5. t1.smonth,
  6. dg.city_code*100 as city_code,
  7. dg.area_code,
  8. t2.station_sid,
  9. t2.station_name,
  10. t1.nh_total,
  11. t2.accrued_power,
  12. t2.cost_unit_name
  13. from sqmdb_cost.v_station_omc_nh t1--专业网管能耗
  14. join
  15. (select yn.smonth,yn.city_name,yn.area_name,sn.station_sid,station_name,yn.accrued_cost,yn.accrued_power,yn.cost_unit_name from sqmdb_cost.ytmx_new yn
  16. join sqmdb_cost.station_nenghao sn on yn.build_code_short=sn.nh_sid_short) t2 --能耗表能耗
  17. on t1.smonth=t2.smonth and t1.station_sid=t2.station_sid
  18. left join sqmdb_cost.dict_grid dg on t2.city_name=dg.city_name and t2.area_name=dg.area_name
  19. where t1.smonth='202204'