park_guidance.txt 639 B

1234567891011121314151617181920
  1. -- 实施停车饱和度
  2. select area_name,
  3. parking_gap_rate
  4. from
  5. (select
  6. t2.area_name,
  7. ifnull(round(count(case when t2.occupancy_rate>90 then park_id end)/count(t2.park_id),2),0)*100 as
  8. parking_gap_rate
  9. from
  10. (SELECT
  11. t.area_name,
  12. t.park_id,
  13. ifnull(a.total_parking_number,0) as total_parking_number,
  14. ifnull(a.remain_parking_number,0) as remain_parking_number,
  15. ifnull(round(remain_parking_number*100/total_parking_number,2),0) as occupancy_rate
  16. FROM
  17. luo_park_baseinfo t
  18. LEFT JOIN luo_parking_berths a ON t.park_id = a.park_id
  19. AND a.CREATE_TIME >= ( SELECT max( CREATE_TIME ) max_time FROM luo_parking_berths )) t2
  20. group by 1) t3