SELECT DATE_FORMAT( deteline, "%Y-%m-%d %H" ) , COUNT( * )
FROM test
GROUP BY DATE_FORMAT( deteline, "%Y-%m-%d %H" )
查询某天:
deteline, "%Y-%m-%d
某时:
deteline, "%Y-%m-%d %H"
依次类推。
其实就是对dateline进行处理,然后再对处理后的数据分组
标签:语句,-%,FORMAT,查询,分组,mysql,DATE,deteline
来源: https://www.cnblogs.com/Rukh/p/16698948.html