-- 实施停车饱和度 select area_name, parking_gap_rate from (select t2.area_name, ifnull(round(count(case when t2.occupancy_rate>90 then park_id end)/count(t2.park_id),2),0)*100 as parking_gap_rate from (SELECT t.area_name, t.park_id, ifnull(a.total_parking_number,0) as total_parking_number, ifnull(a.remain_parking_number,0) as remain_parking_number, ifnull(round(remain_parking_number*100/total_parking_number,2),0) as occupancy_rate FROM luo_park_baseinfo t LEFT JOIN luo_parking_berths a ON t.park_id = a.park_id AND a.CREATE_TIME >= ( SELECT max( CREATE_TIME ) max_time FROM luo_parking_berths )) t2 group by 1) t3