Greetings all,
My booking system includes 2 tables:
tblRooms with the key field RoomID, and some other fields AND a
tblBooked Rooms with a number of fields including RoomID and
BookedDate.
For a given date range, I can generate a vacant room report by
generating a temporary table of all the Rooms and BookedDates using a
cartesian join, and then either deleting the booked rooms, or by
using a 'Not In( )' select query.
Can anyone suggest a solution that does not involve populating a
temporary table?
Peter 5 2783
On Tue, 18 Mar 2008 13:17:33 +1100, Peter Sutton
<ps*****@killspam.com.auwrote:
All temporary tables can be replaced by queries.
-Tom.
> Greetings all,
My booking system includes 2 tables: tblRooms with the key field RoomID, and some other fields AND a tblBooked Rooms with a number of fields including RoomID and BookedDate.
For a given date range, I can generate a vacant room report by generating a temporary table of all the Rooms and BookedDates using a cartesian join, and then either deleting the booked rooms, or by using a 'Not In( )' select query.
Can anyone suggest a solution that does not involve populating a temporary table?
Peter
Tom van Stiphout wrote:
On Tue, 18 Mar 2008 13:17:33 +1100, Peter Sutton
<ps*****@killspam.com.auwrote:
All temporary tables can be replaced by queries.
-Tom.
Rather than building convoluted, nested queries, a report is often more
efficiently produced by intermediate summation of data into temp table(s).
>My booking system includes 2 tables: tblRooms with the key field RoomID, and some other fields AND a tblBooked Rooms with a number of fields including RoomID and BookedDate.
For a given date range, I can generate a vacant room report by generating a temporary table of all the Rooms and BookedDates using a cartesian join, and then either deleting the booked rooms, or by using a 'Not In( )' select query.
Can anyone suggest a solution that does not involve populating a temporary table?
Sounds like you're already there. Try something like:
SELECT RoomID
FROM tblRooms
WHERE RoomID NOT IN
(SELECT DISTINCT RoomID
FROM tblBookedRooms
WHERE BookedDate #2/15/2008#);
On Tue, 18 Mar 2008 01:34:53 -0500, "DFS" <nospam@dfs_.comwrote:
>Tom van Stiphout wrote:
>On Tue, 18 Mar 2008 13:17:33 +1100, Peter Sutton <ps*****@killspam.com.auwrote:
All temporary tables can be replaced by queries. -Tom.
Rather than building convoluted, nested queries, a report is often more efficiently produced by intermediate summation of data into temp table(s).
Thank you for your response.
My first approach is to get a solution that works. I have that.
What I am looking for now, is a better one which I think can be
achieved without recourse to temporary tables and consequent bloat in
the database.
Peter
>>My booking system includes 2 tables: tblRooms with the key field RoomID, and some other fields AND a tblBooked Rooms with a number of fields including RoomID and BookedDate.
For a given date range, I can generate a vacant room report by generating a temporary table of all the Rooms and BookedDates using a cartesian join, and then either deleting the booked rooms, or by using a 'Not In( )' select query.
Can anyone suggest a solution that does not involve populating a temporary table?
Sounds like you're already there. Try something like:
SELECT RoomID FROM tblRooms WHERE RoomID NOT IN (SELECT DISTINCT RoomID FROM tblBookedRooms WHERE BookedDate #2/15/2008#);
Peter Sutton wrote:
On Tue, 18 Mar 2008 01:34:53 -0500, "DFS" <nospam@dfs_.comwrote:
>Tom van Stiphout wrote:
>>On Tue, 18 Mar 2008 13:17:33 +1100, Peter Sutton <ps*****@killspam.com.auwrote:
All temporary tables can be replaced by queries. -Tom.
Rather than building convoluted, nested queries, a report is often more efficiently produced by intermediate summation of data into temp table(s).
Thank you for your response.
My first approach is to get a solution that works. I have that.
What I am looking for now, is a better one which I think can be
achieved without recourse to temporary tables and consequent bloat in
the database.
Peter, You didn't read far enough down in my first response.
SELECT RoomID
FROM tblRooms
WHERE RoomID NOT IN
(SELECT DISTINCT RoomID
FROM tblBookedRooms
WHERE BookedDate #2/15/2008#);
Not using temp tables won't change the 'bloat factor' very much - unless you
rely on them heavily. Access systems bloat in the normal course of
business.
Peter
>>>My booking system includes 2 tables: tblRooms with the key field RoomID, and some other fields AND a tblBooked Rooms with a number of fields including RoomID and BookedDate.
For a given date range, I can generate a vacant room report by generating a temporary table of all the Rooms and BookedDates using a cartesian join, and then either deleting the booked rooms, or by using a 'Not In( )' select query.
Can anyone suggest a solution that does not involve populating a temporary table?
Sounds like you're already there. Try something like:
SELECT RoomID FROM tblRooms WHERE RoomID NOT IN (SELECT DISTINCT RoomID FROM tblBookedRooms WHERE BookedDate #2/15/2008#);
On Wed, 19 Mar 2008 11:06:38 -0500, "DFS" <nospam@dfs_.comwrote:
>Peter Sutton wrote:
>On Tue, 18 Mar 2008 01:34:53 -0500, "DFS" <nospam@dfs_.comwrote:
>>Tom van Stiphout wrote: On Tue, 18 Mar 2008 13:17:33 +1100, Peter Sutton <ps*****@killspam.com.auwrote:
All temporary tables can be replaced by queries. -Tom.
Rather than building convoluted, nested queries, a report is often more efficiently produced by intermediate summation of data into temp table(s).
Thank you for your response.
My first approach is to get a solution that works. I have that.
What I am looking for now, is a better one which I think can be achieved without recourse to temporary tables and consequent bloat in the database.
Peter, You didn't read far enough down in my first response.
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.
> Not using temp tables won't change the 'bloat factor' very much - unless you rely on them heavily. Access systems bloat in the normal course of business.
Yes I know about bloat. Where I use temporary tables, they are always
put in temporary MDBs which the system blows away every say 20 logins
and recreates.
Peter
>
>>
>>>>My booking system includes 2 tables: tblRooms with the key field RoomID, and some other fields AND a tblBooked Rooms with a number of fields including RoomID and BookedDate. > For a given date range, I can generate a vacant room report by generating a temporary table of all the Rooms and BookedDates using a cartesian join, and then either deleting the booked rooms, or by using a 'Not In( )' select query. > Can anyone suggest a solution that does not involve populating a temporary table?
Sounds like you're already there. Try something like:
SELECT RoomID FROM tblRooms WHERE RoomID NOT IN (SELECT DISTINCT RoomID FROM tblBookedRooms WHERE BookedDate #2/15/2008#);
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dave Robinson |
last post by:
I was wondering if anyone could help me with a problem I'm having.
I've been using Dreamweaver to create a hotel booking system for a
friend of mine, using MySQL (version 4.0.21) and PHP 5. The...
|
by: Grant |
last post by:
Hi
I have a database which logs the usage of rooms. Some booking are entered
well in advance, and some have stays of more than six months.
I would like to ensure that rooms which have been...
|
by: WiseOwl |
last post by:
Hi folks
I teach. At school, four IT rooms are booked using a paper based outline
timetable. Completing it is easy but basic and impossible to ensure
completion of all fields (name, year...
|
by: Andy |
last post by:
Hi folks
I teach. At school, four IT rooms are booked using a paper based outline
timetable. Completing it is easy but basic and impossible to ensure
completion of all fields (name, year...
|
by: bredal Jensen |
last post by:
Hello gurus,
I'm building a small booking system and i have come accross quiet a tedious
pitfall.
"I need to make sure that people do not book for tomorrow when todays time
is greater or...
|
by: thegame21 |
last post by:
Hi, I am currently creating a cinema system using access where a
booking can be made for a event. Each event when it is shown is
categoriesd as a performance. A booking must be made for each...
|
by: markymark34 |
last post by:
Im messing around trying to learn Access and have hit a problem.
I have a table called tblbookings and i want to seach though it when trying to make a new booking to make sure the room isnt alrady...
|
by: simba |
last post by:
Hello,
I am currently doing a project which requires me to develop an online booking system for hotels and integrate both bed and room booking. I have the room booking working but I cant seem to...
|
by: 88stevie |
last post by:
Hi all,
I have a system and I'm a little stuck. It's a booking system.
It has rooms, etc and every room have a daily price.
Then it has special daily rates when assigned.
How do I...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |