日期:2014-05-16 浏览次数:20730 次
select type,count(*) from `table` where date >= '2012-02-04 08:00:00' and date < '2012-02-05 08:00:00' group by type
select DATE_FORMAT(`date`,'%Y%m%d%H') ,Count(*) from `table` where date >= '2012-02-04 08:00:00' and date < '2012-02-05 08:00:00' group by DATE_FORMAT(`date`,'%Y%m%d%H')
------解决方案--------------------
select type,DATE_FORMAT(`date`,'%Y-%m-%d-%H'),count(*) from `table` where date >= '2012-02-04 08:00:00' and date < '2012-02-05 08:00:00' group by type,DATE_FORMAT(`date`,'%Y-%m-%d-%H')