码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-02-01 01:52:02      阅读:176      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!