两个门 进出 一共四个方向 根据日期 对四中情况 就行数量统计
select
count(t.type_0) ,count(t.type_1) ,
count(t.type_2),
count(t.type_3),
t.time
from
(
select
c.carsno,
DECODE(c.gateid,'南门入口','南门入口') as type_0,
DECODE(c.gateid,'南门出口','南门出口') as type_1,
DECODE(c.gateid,'东门出口','东门出口') as type_2,
DECODE(c.gateid,'东门入口','东门入口') as type_3,
substr(c.outintime,9,2) as time
from cars_inoutlog c
where
c.outintime like '%2017-01%'
order by c.outintime
) t
group by t.time
order by t.time