查10月的数据
select DATEPART(HH,请求日期) as 几点,COUNT(*) as 请求人数
from tablename 
where DATEPART(MM,请求日期)=10
group by  DATEPART(HH,请求日期)

解决方案 »

  1.   

    select datepart(hh,[请求日期]) as '几点'
           ,count(distinct [号码]) as  '请求人数'
    From Table1
    where convert(nvarchar(7),[请求日期],120)=convert(nvarchar(7),getdate(),120)
    group by datepart(hh,[请求日期]) 
      

  2.   


    select datepart(d,请求日期) as 时间段,count(*) as 访问人数 from tb
    group by datepart(d,请求日期)
      

  3.   

    select datepart(hour,请求时间) as 请求点,count(号码) as 请求次数
    from tb
    where convert(varchar(7),请求时间,120)=convert(varchar(7),getdate(),120)
    group by datepart(hour,请求时间)