outlookling

博客园 首页 新随笔 联系 订阅 管理
现要做报表,要查出在当天所处的日期区间的某些数据
,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);
posted on 2015-02-01 01:08  jsonZhu  阅读(248)  评论(0编辑  收藏  举报