Select Date Between Two Columns
SELECT * FROM table1
WHERE '2011-01-01' BETWEEN table1.startdate AND table1.enddate
Replace the explicit date either with now()
or a parameter or whatever.
If the enddate is not defined as NOT NULL
you can do:
SELECT * FROM table1
WHERE '2011-01-01' BETWEEN table1.startdate AND COALESCE(table1.enddate, NOW())
See: http://www.1keydata.com/sql/sql-coalesce.html
Does this help you ?
select *
from table
where START_DATE < NOW() AND END_DATE > NOW()
Depending on the database, use CURRENT_TIMESTAMP() or TODAY()