获取某一天每个小时的数据

select hour(dateTime) as hour, count(1) as count
from tableName
where DATE_FORMAT(dateTime,'%Y-%m-%d') = '2001-01-01'
group by hour(dateTime);

 

 

SELECT COUNT(1) FROM wx_pvuv_log where DATE_FORMAT(create_time,'%Y-%m-%d %H') = '2015-07-20 21';

posted @ 2016-01-11 18:16  ordinary01  阅读(549)  评论(0编辑  收藏  举报