-- ��Сʱͳ���볡
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