Re: Booking System - Vacant room report
- From: Peter Sutton <psutton@xxxxxxxxxxxxxxx>
- Date: Fri, 21 Mar 2008 13:16:11 +1100
On Thu, 20 Mar 2008 10:48:35 -0500, "DFS" <nospam@xxxxxxxx> wrote:
Peter Sutton wrote:
SELECT RoomID
FROM tblRooms
WHERE RoomID NOT IN
(SELECT DISTINCT RoomID
FROM tblBookedRooms
WHERE BookedDate > #2/15/2008#);
You are correct, I did not see this bit at the bottom of your
message.
However, say RoomID 2 is booked on Feb 17 but not after, I think your
sub query would show this room booked for the whole period.
huh?
Apologies if my question was not clear.
You'll have to substitute the actual dates and use Between or <=>
(BookedDate Between #2/15/2008# And #3/15/2008#)
(BookedDate >= #2/15/2008# And BookedDate <= #3/15/2008#)
If a room is booked for any one night in the range in the sub query,
then it's ID will be returned from the subquery. Therefore, it will
not appear in the results of the main query.
So your query will return rooms that were not booked for any day in
the date range whereas I am looking for days that rooms are vacant in
the period.
Your query does of course work for a single day. So I suppose I could
generate a report based on the top 30 records of any table but having
the report generate data for 30 consecutive days and having sub
reports based on a single day query.
But as I like to keep things simple, I think I'll stick to my temp
table.
Thanks for taking the time to respond.
Peter
.
- References:
- Booking System - Vacant room report
- From: Peter Sutton
- Re: Booking System - Vacant room report
- From: Tom van Stiphout
- Re: Booking System - Vacant room report
- From: DFS
- Re: Booking System - Vacant room report
- From: Peter Sutton
- Re: Booking System - Vacant room report
- From: DFS
- Re: Booking System - Vacant room report
- From: Peter Sutton
- Re: Booking System - Vacant room report
- From: DFS
- Booking System - Vacant room report
- Prev by Date: Re: Mostly OT: Have any MVP's looked at the source code for MS' operating systems?
- Next by Date: Re: Booking System - Vacant room report
- Previous by thread: Re: Booking System - Vacant room report
- Next by thread: Re: Booking System - Vacant room report
- Index(es):
Relevant Pages
|