资源系统局站表更新.sql 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. --资源系统局站表更新
  2. --truncate table sqmdb_cost.station3;
  3. --insert into sqmdb_cost.station3
  4. select
  5. s.station_sid,
  6. s.station_sname,
  7. d1.dicttext as city_name,
  8. d2.dicttext as area_name,
  9. d4.dicttext as property_type,
  10. d5.dicttext as property_unit,
  11. s.baidu_longitude as longitude,
  12. s.baidu_latitude as latitude,
  13. d6.dicttext as res_level,
  14. d3.dicttext as station_type,
  15. d7.dicttext as station_level,
  16. s.tower_code,
  17. s.grade_name,
  18. s.wx_type,
  19. s.oss_station
  20. from sqmdb_cost.station s
  21. left join sqmdb_cost.dict d1 on d1.dictid=s.city_code::varchar
  22. left join sqmdb_cost.dict d2 on d2.dictid=s.area_code::varchar
  23. left join sqmdb_cost.dict d3 on d3.dictid=s.station_type::varchar
  24. left join sqmdb_cost.dict d4 on d4.dictid=s.property_type::varchar
  25. left join sqmdb_cost.dict d5 on d5.dictid=s.property_unit::varchar
  26. left join sqmdb_cost.dict d6 on d6.dictid=s.stationlvl::varchar
  27. left join sqmdb_cost.dict d7 on d7.dictid=s.station_level::varchar
  28. --更新能耗索引表
  29. insert into sqmdb_cost.station_nenghao
  30. select station_sid,unnest(string_to_array(oss_station,','))::numeric as oss_station from sqmdb_cost.station