Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MySQL (http://www.go4expert.com/forums/mysql-forum/)
-   -   [MySQL 5] Fetching records for common dates (http://www.go4expert.com/forums/mysql-5-fetching-records-common-dates-t24186/)

cancer10 15Dec2010 23:21

[MySQL 5] Fetching records for common dates
 
Hi peps,

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

Please take a look into the room table.

http://img152.imageshack.us/img152/5...ection001j.png

The following is the order table:

http://img69.imageshack.us/img69/8384/selection002m.png




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.

http://img253.imageshack.us/img253/5...ection003l.png




Please if anyone can help?

Many thanks in advance :)

shabbir 16Dec2010 09:35

Re: [MySQL 5] Fetching records for common dates
 
Join both the tables based on Room ID and it will give you what you want.


All times are GMT +5.5. The time now is 08:46.