1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

[MySQL 5] Fetching records for common dates

Discussion in 'MySQL' started by cancer10, Dec 15, 2010.

  1. cancer10

    cancer10 New Member

    Joined:
    Jul 12, 2008
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Webmaster
    Location:
    India
    Hi peps,

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

    Please take a look into the room table.

    [​IMG]

    The following is the order table:

    [​IMG]




    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.

    [​IMG]




    Please if anyone can help?

    Many thanks in advance :)
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Join both the tables based on Room ID and it will give you what you want.
     

Share This Page