[MySQL 5] Fetching records for common dates

Go4Expert Member
15Dec2010,23:21   #1
cancer10's Avatar
Hi peps,

I have a query about a hotel's room booking system.

Please take a look into the room table.



The following is the order table:






What query would fetch me the date(s) which has all rooms (8 in this case) booked on that date?

For this case it would be 2010-12-10 and 2010-12-20, since all 8 rooms have been booked for the date.






Please if anyone can help?

Many thanks in advance
Go4Expert Founder
16Dec2010,09:35   #2
shabbir's Avatar
Join both the tables based on Room ID and it will give you what you want.