Using Yii CDbCriteria to query a table in a plugin
Try this (untested)

$criteria = 'cottage = :cottage and ((fromdate between :d1 and :d2) or(toDate between :d1 and :d2))';
$params = array('cottage' =&gt; $booking-&gt;cottage, 'd1' =&gt; $booking-&gt;fromDate, 'd2' =&gt; $booking-&gt;toDate);
$previousBookings = BookingEngine_BookingsRecord::model()-&gt;findAll($criteria, $params);