期間中の無料ではない部屋を表示するクエリは次のとおりです。
select room from bookings where
(arrival<'2011-03-12' and departure>='2011-03-12') -- overlap at the end
OR (arrival<='2011-03-10' and departure>'2011-03-10') -- overlap at the start
OR (arrival>='2011-03-10' and departure<='2011-03-12') -- complete overlap
これは
で使用できますselect roomnumber from rooms where roomnumber not in (... as above ...)
無料の部屋を探す