Oracle decode使用

前端之家收集整理的这篇文章主要介绍了Oracle decode使用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


两个门 进出 一共四个方向 根据日期 对四中情况 就行数量统计


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,'南门出口','南门出口') as type_1,'东门出口','东门出口') as type_2,'东门入口','东门入口') 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相关文章