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 advanceSELECT 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?
:D|||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?
:D
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.|||And where might that be?|||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.
Wednesday, March 7, 2012
Help:Select query
Labels:
combination,
customersthe,
database,
databasethe,
helpselect,
microsoft,
mysql,
oracle,
primary,
query,
roomsand,
second,
server,
sql,
table,
tables,
third
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment