My table has a column (datetime) for start date and time, "startdate", and a column (datetime) for end date and time, "endtime".
I want to select rows from the table where the startdate and enddate include a specified date.
Example: I have a row that has a startdate of 2014-06-22 20:00:00 and an enddate of 2014-06-29 23:00:00 and I want to select that row with the specified date range for a given day (2014-06-25).
Here is my query that is not currently doing what I want it to...
SELECT * FROM my_tbl WHERE `startdate` >= '2014-06-22 00:00:00' AND `enddate` <= '2014-06-22 23:59:59'
I have also tried the Between in the SQL query. I think I am going to have to create a date range with the startdate and enddate and reference that from the specified date but I don't know how to do that. Please help!
EDIT:
My table has 2 date columns. I am injecting a specific day (2014-06-25). I want to return rows that have a start date (startdate) before or on the specified day and an end date (enddate) after or on the specified date. So basically I want active rows to show up based on a specified day.