I have three table
Type (id, libel)
Bedroom (id, name, type)
Reservation (id, name, libel, start_date, end_date, room)
I want to make an application where you could get all the rooms and reservations between two dates. I have the following query
$sql = 'SELECT r.id, r.name, r.start_date, r.end_date, r.libel, r.statut ,c.name as room, t.libel as type '
. 'FROM type t INNER JOIN Bedroom c ON t.id = c.type LEFT JOIN reservation r ON c.id = r.room'
. 'WHERE ( :start_date BETWEEN r.start_date AND r.end_date '
. ' OR :end_date BETWEEN r.start_date AND r.end_date'
. ' OR r.start_date BETWEEN :start_date AND :end_date'
. ' OR r.end_date BETWEEN :start_date AND :end_date) ORDER BY c.'.$orderColumn.' ASC';
But it appears that rooms be reserved between start_date and end_date.