我正在开展一个关于酒店房间预订的项目。
我有4张桌子:
房间(room_id,类别,价格);
booking_rooms(idbr,room_id,booking_id);
预订(booking_id,client_id,checkin,checkout);
客户(client_id,fistname,姓氏,地址,电话,电子邮件);
我想创建一个搜索表单来检查签入和结帐日期和类别之间的可用空间。
SELECT * FROM rooms
WHERE room_id NOT IN (select room_id
from bookings_rooms
WHERE (checkin < '$checkindate'
AND checkout > '$checkoutdate')
or (checkin> '$checkindate'
AND checkin< '$checkindate'))
这就是我所做的。并且它无法正常工作。
你能帮助我吗?你能给我一个想法吗?答案 0 :(得分:0)
select * from rooms
where room_id not in
(select room_id from bookings_rooms
where booking_id where not in //or in :)
(select booking_id from bookings
where (checkin < '$checkindate'
AND checkout > '$checkoutdate')
or (checkin> '$checkindate'
AND checkin< '$checkindate')))