I have a MySQL Datatable with an ID, two datetime and a boolean column.
Looks like this:
CREATE TABLE `Example` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Date1` date NOT NULL,
`Date2` date NOT NULL,
`Answered` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Now I have a startdate and an enddate, and I need a sql query which gives me that rows, where any day between the startdate and the enddate is between Date1 and Date2!
What works is that query, wich gives me those rows, where the Date1 is between the startdate and the enddate and Aswered = 1:
$proof = "select * from Example where Date1
between '$startdate' and '$enddate' and Answered = 1";
But I dont know how to do that with all dates between two dates
Thanks for help!