zoukankan      html  css  js  c++  java
  • orcl between and 时间

    在网上查阅,大家都说between and两边都会包含,但是对于时期来讲,他会包含前者,不会包含后者。

    也就是说求一个时间介于上周六到本周五的区间,用between and 需要计算出上周六的时间和本周六的时间作为区间,如果以本周五的时间作为区间的话,

    本周五的数据是无法获取的。

    代码说明:

    在表中创建了一条本周五的数据。

    select (trunc(sysdate, 'D') - 1) upSaturday,  (trunc(sysdate, 'D') + 5) Friday ,(trunc(sysdate, 'D') + 6) Saturday from dual;
    

    查出上周六、本周五、本周六时间作为参考。

    select count(*) from zx_gzdb_report_content where create_time between (trunc(sysdate, 'D') - 1) and (trunc(sysdate, 'D') + 5);
    

    第一次我们取区间上周六本周五得到的数据是0。

    select count(*) from zx_gzdb_report_content where create_time between (trunc(sysdate, 'D') - 1) and (trunc(sysdate, 'D') + 6);
    

    第二次我们取区间上周六本周六,可以获取本周五数据。

  • 相关阅读:
    mustache.js 使用
    iscroll4 input textarea不能获得焦点问题
    object-fit?
    window.open()被拦截问题
    JSONP
    mouseenter和mouseover的区别
    前端页面卡顿-代码优化
    如何设置html中img宽高相同-css
    iscroll使用之页面卡顿问题
    iScroll的简单使用
  • 原文地址:https://www.cnblogs.com/ckxlovejava/p/7428847.html
Copyright © 2011-2022 走看看