2013-08-01 00:03:00
2013-08-01 00:04:00
2013-08-01 00:06:00
2013-08-01 00:09:00
2013-08-01 00:13:00
2013-08-01 00:17:00
2013-08-01 00:20:00
2013-08-01 00:22:00
2013-08-01 00:23:00从2013-08-01 00:00:00开始,到2013-08-02 00:00:00 结束,统计每十分钟出现的次数,例如
2013-08-01 00:00:00 到 2013-08-01 00:10:00 出现4次timestampmysql

解决方案 »

  1.   

    select count(*) from tbl where col between '2013-08-01 00:00:00' and '2013-08-01 00:10:00 ';
      

  2.   

    select substring(timecol,1,15),count(*) 
    from tbl 
    group by substring(timecol,1,15)
      

  3.   

    我猜上面那个不是你想要的 而这个应该是(tbl和col是表名和列名)~~~
    select floor(unix_timestamp(col)/600)*600 as begin_time, count(*) 
    from tbl 
    group by begin_time;
      

  4.   

    select from_unixtime(floor(unix_timestamp(date_time)/600)*600) as begin_time, count(*) 
     from host_performance 
     group by begin_time;