Sorry to post this here, I have been trying for a few hours now to construct this (mostly using access to see how things work, then trying out combinations.)
Where I work, we have a number of rooms with different equipment in (Projectors, coffee machines, tables etc)
I am trying to build a simple query to allow the user to say I need a room for 5 hours, Tomorrow, and it must have a projector.
I can build a simple query to get the rooms that have my criteria, such as
"select * from tblRoom where tblRoom.projector=true"
This returns a list of all potential rooms.
How can I modify this the query to list only rooms that match the criteria, but also are not listed in a second table (tblBooking) for the users date and time ?
(The tblBookings table has a foreign key pkRoom that is the Primary key of each room)
I have tried
"SELECT * FROM tblRoom LEFT JOIN tblBookings WHERE (tblRoom.projector=true) AND (tblBooking.fKeyRoom <> tblRoom.pkRoom)"
But this returns me nothing. ( I know that this doesn't include date time as criteria, but initially I would just like to be able to list all rooms with projectors that aren't booked ! (Small steps to begin with))
Any help greatfully recieved.
K
Where I work, we have a number of rooms with different equipment in (Projectors, coffee machines, tables etc)
I am trying to build a simple query to allow the user to say I need a room for 5 hours, Tomorrow, and it must have a projector.
I can build a simple query to get the rooms that have my criteria, such as
"select * from tblRoom where tblRoom.projector=true"
This returns a list of all potential rooms.
How can I modify this the query to list only rooms that match the criteria, but also are not listed in a second table (tblBooking) for the users date and time ?
(The tblBookings table has a foreign key pkRoom that is the Primary key of each room)
I have tried
"SELECT * FROM tblRoom LEFT JOIN tblBookings WHERE (tblRoom.projector=true) AND (tblBooking.fKeyRoom <> tblRoom.pkRoom)"
But this returns me nothing. ( I know that this doesn't include date time as criteria, but initially I would just like to be able to list all rooms with projectors that aren't booked ! (Small steps to begin with))
Any help greatfully recieved.
K