Reputation: 59
I have database with 4 tables:
The last table has the following columns:
but this table stores only records with rooms that has Subject (it keep only busy hours of rooms), it doesn't presents records with empty subjects so it can't show me when a chosen room is available (no subject means the room is clear).
I want to somehow write a query that will give me the status of all the rooms in a specific day and hour.
For example this query returns all the busy rooms at day 1, hour 1:
SELECT *
FROM TimeTables
WHERE HourNumber = 1 AND DayNumber = 1
But I want to get the status of all the rooms at the specific time, I know the rest of the records doesn't exists.
Is there a way to do something like that?
Upvotes: 0
Views: 139
Reputation: 1271061
If you want the status of the rooms in MS Access, I think a correlated subquery is the simplest method:
select r.*,
(select tt.subject
from TimeTables as tt
where tt.RoomNumber = r.RoomNumber and tt.HourNumber = 1 and tt.DayNumber = 1
) as subject_1_1
from rooms as r;
Upvotes: 1