select  click_hour,click_cnt

from user_ad_click_time

click_hour 哪个 小时 为广告点击的高峰期

click_cnt 发生的点击次数

思路:

1 先将点击按小时分类 

case 

    when click_time between '08:00:00' and '08:59:59' then '8点'

    when click_time between '09:00:00' and '09:59:59' then '9点'

case when 这个思路不行,得分24个太麻烦了,用hour函数提取

2 提取小时

hour(click_time)  

count数出小时最多,排倒序,取第一位

count(hour(click_time))  limit 1

    select 

         hour(click_time)  click_hour

        ,count(hour(click_time)) click_cnt

    from user_ad_click_time

    group by hour(click_time)

    order by click_cnt desc

    limit 1

有没有大佬提供一下思路这个高峰不唯一怎么解?