Oracle decode使用
2017-03-03 18:02
399 查看
两个门 进出 一共四个方向 根据日期 对四中情况 就行数量统计
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
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
相关文章推荐
- Oracle的decode()函數使用技巧
- Oracle中Decode()函数使用技巧
- Oracle Decode 使用 技巧
- Oracle中Decode()函数使用技巧
- Oracle中Decode()函数使用技巧
- [摘录]Oracle中Decode()函数使用技巧
- Oracle中Decode()函数使用技巧(借来看看)
- Oracle:Decode在时间范围中的使用.
- Oracle中Decode()函数使用技巧
- Oracle中Decode()函数使用技巧
- Oracle中Decode()函数的使用 推荐
- Oracle中Decode()函数使用技巧
- Oracle中Decode()函数的使用
- ORACLE中使用decode实现行转列以及使用case通用的行转列
- Oracle中Decode()函数使用技巧
- oracle中decode和case的使用例子
- 解析:怎样使用Oracle的DECODE()函数
- Oracle中Decode()函数使用技巧
- 使用oracle的decode总结
- Oracle中Decode()函数使用技巧