Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    18

    Unanswered: Help:Select query

    I have 3 tables in my database

    The first Table is called Customers

    The second Table is called Rooms

    And the third table is a combination of the primary keys of Customer table and the Rooms Table.



    The Room tables consist of 50 rooms and only 30 of these rooms are currently
    occupied. I need a query to find the available room numbers that are not
    currently in use.


    The query below the retrieve the occupied room



    SELECT Room.Room, Room.Telefon

    FROM ThirdTableINNER JOIN

    Room ON ThirdTableINNER .RoomID = Room.RoomID



    Thanks in advance

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    SELECT Room.Room, Room.Telefon

    FROM ThirdTable a RIGHT JOIN

    Room b ON a .RoomID = b.RoomID

    WHERE a.RoomId IS NULL

    Are the rooms rented in units of 15 minutes?

    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Oct 2003
    Posts
    18
    Originally posted by Brett Kaiser
    SELECT Room.Room, Room.Telefon

    FROM ThirdTable a RIGHT JOIN

    Room b ON a .RoomID = b.RoomID

    WHERE a.RoomId IS NULL

    Are the rooms rented in units of 15 minutes?

    Thank u Brett Kaiser for the help. The query was great. Actually all rooms are almost full, but because you did a great job, as the Manager of the Hotel I will offer you 3 nights stay FOC.

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    And where might that be?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Oct 2003
    Posts
    18
    Originally posted by Brett Kaiser
    And where might that be?
    We have branch offices world wide, all you need to do is to specify your location I will send a comfirmation to that branch.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •