-1

In my table I have this

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   

if todays date is 2010-10-05 I want to select all the records that are within the bounds, i.e that started today or earlier and not have not reached the end_date yet

so in this case it would be

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
Vaishak Suresh
  • 5,535
  • 9
  • 39
  • 64
Asim Zaidi
  • 25,390
  • 48
  • 128
  • 219

1 Answers1

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

Assuming your start_date and end_date are of DATE type, otherwise you'll need to convert to DATE

Majid Laissi
  • 18,348
  • 18
  • 64
  • 104