Q:

How to select free rooms for reservations in CodeIgniter - two tables?

I want to select free rooms between dateStart and dateEnd in CodeIgniter.
I have 2 tables - rooms and reservations.
My current model code:
$this->db->select('rooms.*');

$this->db->join('reservations', 'rooms.ID = reservations.RoomID', 'left outer');

$this->db->where('rooms.Size >=', $PeopleNumber);
$this->db->where('reservations.DateStart <=', $DateEnd);
$this->db->where('reservations.DateEnd >=', $DateStart);

$this->db->group_by('rooms.Size');

$query = $this->db->get('rooms');

I've already checked this question: MySQL Looking for free rooms in reservation system
but I don't know how to multiselect in CodeIgniter.
My SQL Fiddle: http://sqlfiddle.com/#!9/c1f95/8

A:

Ok i resolved this:
$this->db->where('`ID` NOT IN (SELECT `RoomID` FROM `reservations` WHERE `DateStart` < "' .$DateEnd. '" AND `DateEnd` > "' .$DateStart. '")', NULL, FALSE);

