zoukankan      html  css  js  c++  java
  • mysql 每4小时统计一次数据

    问题 : 每4小时统计一次数据  ;

    需求分析:0~23 分成6组 分别是:

     
     mysql 实现逻辑 :
     1 select id,FLOOR(id/4) hourGroup
     2 , case FLOOR(id/4)
     3         when 0 then '00:00~04:00'
     4         when 1 then '04:00~08:00'
     5         when 2 then '08:00~12:00'
     6         when 3 then '12:00~16:00'
     7         when 4 then '16:00~20:00'
     8         when 5 then '20:00~00:00' end hourRange
     9 from (
    10 select     0    as id  union
    11 select     1    as id  union
    12 select     2    as id  union
    13 select     3    as id  union
    14 select     4    as id  union
    15 select     5    as id  union
    16 select     6    as id  union
    17 select     7    as id  union
    18 select     8    as id  union
    19 select     9    as id  union
    20 select     10    as id  union
    21 select     11    as id  union
    22 select     12    as id  union
    23 select     13    as id  union
    24 select     14    as id  union
    25 select     15    as id  union
    26 select     16    as id  union
    27 select     17    as id  union
    28 select     18    as id  union
    29 select     19    as id  union
    30 select     20    as id  union
    31 select     21    as id  union
    32 select     22    as id  union
    33 select     23    as id  
    34 ) t
    35 order by id  ;
    View Code

  • 相关阅读:
    day35-python-网络编程
    oc-继承(inherit) 方法重写 继承与组合
    oc-self关键字
    oc-类方法
    oc-封装 get set方法
    oc-匿名对象
    oc-函数命名
    oc-函数,方法,类
    解决"authentication token manipulation error"
    让tomcat自动定位到项目
  • 原文地址:https://www.cnblogs.com/linbo3168/p/13680768.html
Copyright © 2011-2022 走看看