_xkoko
COCO 很懒 什么都没留下......

--String 类型 转化为 年月日  yyyy-mm-dd      to_date(substr(t.submit_time,1,10)))

如果统计一年  需要用  left  join 

(select level mymonth from dual
connect by level<13) n  

left join  (

select  extract(month from to_date(v.CHECK_TIME,'yyyy-mm-dd hh24:mi:ss')) as  tmonths from table_name v

group by extract(month from to_date(v.CHECK_TIME,'yyyy-mm-dd hh24:mi:ss')) 

ORDER BY tmonths  ) m  on  m.tmonths  =n.mymonth 

posted on 2018-07-27 15:09  _xkoko  阅读(6918)  评论(1编辑  收藏  举报