zoukankan      html  css  js  c++  java
  • 如何查询当前时间是否在某个时间段内

    select * from table where starttime<=curtime() and endtime>=curtime();

    开始时间小于结束时间 (时间段在一天内)
    开始时间大于结束时间 (时间段跨天<不在同一天>)
    select id, case when starttime<=endtime then 1 else 0 end as s1
    from table
    where  (s1=1)  and  curtime() >= starttime and curtime() <= endtime ;
    untion all
    select id, case when starttime<=endtime then 1 else 0 end as s1
    from table
    where  (s1=0)  and  curtime() <= starttime and curtime() >= endtime ;

    纵有白头俱老意,奈何缘浅路芊芊.
  • 相关阅读:
    仪仗队
    疫情控制
    Code
    距离咨询
    舒适的路线
    桐桐的糖果计划
    跑路
    最短路计数
    骑马修栅栏
    搭桥
  • 原文地址:https://www.cnblogs.com/hanby/p/14317832.html
Copyright © 2011-2022 走看看