-1

在我的桌子上我有这​​个

start_date   end_date   record_id
2012-10-05   2012-11-05   1 
2012-10-06   2012-12-05   2 
2012-10-05   2012-09-05   3 
2012-11-05   2012-11-30   4 
2012-09-05   2012-11-21   5 
2012-10-05   2012-11-22   6   

如果今天的日期是2010-10-05我想选择范围内的所有记录,即今天或更早开始并且尚未达到 end_date

所以在这种情况下

2012-10-05   2012-11-05   1 
2012-10-06   2012-12-05   2 
2012-09-05   2012-11-21   5  // doesnt't end till 2012-11-21
2012-09-05   2012-11-22   6  // doesnt't end till 2012-11-22
4

1 回答 1

4
SELECT * FROM TABLE
WHERE start_date < SYSDATE()
AND  end_date  > SYSDATE()

假设您的start_dateandend_dateDATE类型,否则您需要转换为DATE

于 2012-10-23T20:17:28.370 回答