mysql按日期检索数据

说明:
按日期归类, 查询2016年5月1号到5月31号每天用户注册数量
直接上源码:

select DATE_FORMAT( creationTime, "%Y-%m-%d" ) , COUNT( * )   from hfh_user where (regDatetime > 1462032000 and regDatetime<1464624000)
GROUP BY DATE_FORMAT( creationTime, "%Y-%m-%d" ) 

结果:

日期	注册人数
2016-05-01	42
2016-05-02	45
2016-05-03	49
2016-05-04	61
2016-05-05	80
2016-05-06	105
2016-05-07	112
2016-05-08	99
2016-05-09	33
2016-05-10	164
2016-05-11	159
2016-05-12	30
2016-05-13	56
2016-05-14	26
2016-05-15	22
2016-05-16	87
2016-05-17	51
2016-05-18	298
2016-05-19	300
2016-05-20	33
2016-05-21	31
2016-05-22	22
2016-05-23	50
2016-05-24	18
2016-05-25	31
2016-05-26	36
2016-05-27	23
2016-05-28	18
2016-05-29	18
2016-05-30	21
原文地址:https://www.cnblogs.com/mslagee/p/5604623.html