这不是典型的count \ group by语法嘛
select 姓名,函数(时间),count(1)
from 表名
group by 姓名,函数(时间)
其中,函数(时间)主要是对时间进行归类转换,需要你自己去解决,举个例子:
        函数(2014-1-07 08:53:11) = 2013-1-07 09:00点前
具体是怎么实现转换的就上百度查API吧。

解决方案 »

  1.   

    select  t.name, ( case when to_char(t.end_time,'hh24')<9 then '9点前'
                            when to_char(t.end_time,'hh24')>= 9 and to_char(t.end_time,'hh24')<10 then ‘10点前’
    else '10点后'
       end),count(*)
    from tab t
    group by t.name, ( case when to_char(t.end_time,'hh24')<9 then '9点前'
                            when to_char(t.end_time,'hh24')>= 9 and to_char(t.end_time,'hh24')<10 then ‘10点前’
    else '10点后'
       end)
      

  2.   

    这个是我需要的,但还有点问题,如果是点后的没有数据  能不呢个返回个值为  0加个nvl(字段,0)
      

  3.   

    这个是我需要的,但还有点问题,如果是点后的没有数据  能不呢个返回个值为  0加个nvl(字段,0)直接nvl(字段,0)不行的 空还是现实不出来