to_char(to_date( time,'yyyy-mm-dd hh24:mi:ss'),'Q')='&季度'
to_char(to_date( time,'yyyy-mm-dd hh24:mi:ss'),'mm')='&月份'
to_char(to_date( time,'yyyy-mm-dd hh24:mi:ss'),'ww')='&周'
to_char(to_date( time,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd')='&日'
to_char(to_date( time,'yyyy-mm-dd hh24:mi:ss'),'hh')=lpad('&时', 2, 0)
--分上下半年统计
select (case when t>='01' and t<'07' then '上半年' else '下半年' end) q,sum(c) c from (
select count(1) c,substr(time,6,2) t from tablename
--where time like '2014%'
group by substr(time,6,2)
)group by (case when t>='01' and t<'07' then '上半年' else '下半年' end)