select count(*) from abc Group By Hour(time) 

解决方案 »

  1.   

    Select Convert(Char(4), DatePart(Year, timecolumn)) + '-' + 
           Convert(Char(2), DatePart(Month, timecolumn)) + '-' + 
           Convert(Char(2), DatePart(Day, timecolumn)) + ' ' + 
           Convert(Char(2), DatePart(Hour, timecolumn)), 
           Max(Count(*))
    From tablename
    Group By Convert(Char(4), DatePart(Year, timecolumn)) + '-' + 
           Convert(Char(2), DatePart(Month, timecolumn)) + '-' + 
           Convert(Char(2), DatePart(Day, timecolumn)) + ' ' + 
           Convert(Char(2), DatePart(Hour, timecolumn))
      

  2.   

    如果是SQLServer
    select top 1 datepart(hh,timecolumn)as timecolumn ,count(*) as [COUNT] from mytable group by datepart(hh,timecolumn) order by count(*) desc
      

  3.   

    select count(*) as c,DATEPART (hh,t) as tt from table1 group by DATEPART(hh,t) order by c desct为时间字段