一、时间函数
toStartOfDay
将DateTime向前取整到今天的开始。
toStartOfHour
将DateTime向前取整到当前小时的开始。
toStartOfMinute
将DateTime向前取整到当前分钟的开始。
toStartOfSecond
将DateTime向前取整到当前秒数的开始。
二、查询语句
select toStartOfHour(event_time) hour , count(*) num from dwd_ceph_nginx_log WHERE event_time > '2022-06-16 15:00:00' group by toStartOfHour(event_time) ORDER BY toStartOfHour(event_time) LIMIT 10;