首页 > 其他 > 详细

查出在当天所处的日期区间的某些数据

时间:2015-02-01 01:50:48      阅读:261      评论:0      收藏:0      [点我收藏+]
现要做报表,要查出在当天所处的日期区间的某些数据
,sql语句该怎么写?
就是说 无法直接输入日期,日期得在其他表的start date 和 end date 中获得。

select *
from a
  where a.time between
        (select b.startdate
           from b b
          where sysdate between startdate and enddate)
    and (select b.enddate
           from b b
where sysdate between startdate and enddate);

查出在当天所处的日期区间的某些数据

原文:http://www.cnblogs.com/outlooking/p/4265003.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!