123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- -- 按小时统计入场
- select
- time_id,
- ifnull(park_num,0) as park_num
- from
- luo_time_data b
- left join
- (select
- hour(in_time) in_hour,
- case when count(parking_no) is null then 0 else count(parking_no) end as park_num
- from
- luo_park_baseinfo t
- LEFT JOIN luo_parking_inrecord a
- ON t.park_id = a.park_id
- WHERE
- t.area_id = '411102'
- AND t.keys_areas = '商圈'
- AND t.street_name LIKE '%人民%'
- group by 1
- order by 1) c
- on b.time_id=c.in_hour
- -- 按小时统计出场
- select
- time_id,
- ifnull(park_num,0) as park_num
- from
- luo_time_data b
- left join
- (select
- hour(out_time) out_hour,
- case when count(parking_no) is null then 0 else count(parking_no) end as park_num
- from
- luo_park_baseinfo t
- LEFT JOIN luo_parking_outrecord a
- ON t.park_id = a.park_id
- WHERE
- t.area_id = '411102'
- AND t.keys_areas = '商圈'
- AND t.street_name LIKE '%人民%'
- group by 1
- order by 1) c
- on b.time_id=c.out_hour
- -- 按日统计入场
- select
- day(in_time) in_day,
- case when count(parking_no) is null then 0 else count(parking_no) end as park_num
- from
- luo_park_baseinfo t
- LEFT JOIN luo_parking_inrecord a
- ON t.park_id = a.park_id
- WHERE
- t.area_id = '411102'
- AND t.keys_areas = '商圈'
- AND t.street_name LIKE '%人民%'
- group by 1
- order by 1
- -- 按日统计出场
- select
- day(out_time) in_day,
- case when count(parking_no) is null then 0 else count(parking_no) end as park_num
- from
- luo_park_baseinfo t
- LEFT JOIN luo_parking_outrecord a
- ON t.park_id = a.park_id
- WHERE
- t.area_id = '411102'
- AND t.keys_areas = '商圈'
- AND t.street_name LIKE '%人民%'
- group by 1
- order by 1
- -- 按周统计入场
- select
- WEEKDAY(in_time)+1 as week_day,
- case when count(parking_no) is null then 0 else count(parking_no) end as park_num
- from
- luo_park_baseinfo t
- LEFT JOIN luo_parking_inrecord a
- ON t.park_id = a.park_id
- WHERE
- t.area_id = '411102'
- AND t.keys_areas = '商圈'
- AND t.street_name LIKE '%人民%'
- group by 1
- order by 1
- -- 按周统计出场
- select
- WEEKDAY(out_time)+1 as week_day,
- case when count(parking_no) is null then 0 else count(parking_no) end as park_num
- from
- luo_park_baseinfo t
- LEFT JOIN luo_parking_outrecord a
- ON t.park_id = a.park_id
- WHERE
- t.area_id = '411102'
- AND t.keys_areas = '商圈'
- AND t.street_name LIKE '%人民%'
- group by 1
- order by 1
- -- 按年统计入场
- SELECT YEAR
- ( in_time ) AS week_day,
- CASE
-
- WHEN count( parking_no ) IS NULL THEN
- 0 ELSE count( parking_no )
- END AS park_num
- FROM
- luo_park_baseinfo t
- LEFT JOIN luo_parking_inrecord a ON t.park_id = a.park_id
- AND t.area_id = '411102'
- AND t.keys_areas = '商圈'
- AND t.street_name LIKE '%人民%'
- GROUP BY 1
- ORDER BY 1
- -- 按年统计出场
- SELECT YEAR
- ( out_time ) AS week_day,
- CASE
-
- WHEN count( parking_no ) IS NULL THEN
- 0 ELSE count( parking_no )
- END AS park_num
- FROM
- luo_park_baseinfo t
- LEFT JOIN luo_parking_outrecord a ON t.park_id = a.park_id
- AND t.area_id = '411102'
- AND t.keys_areas = '商圈'
- AND t.street_name LIKE '%人民%'
- GROUP BY 1
- ORDER BY 1
|