View Single Post
  #5  
Old October 8th, 2005, 12:27 AM
Abe
external usenet poster
 
Posts: n/a
Default

Thanks for the reply Haris,
I think I understand what you are saying, however the problem arises
when there are two different people assigned to One Hotel Booking,
as you indicate about the 2 Smiths.

For Example: Smith and Jones booked into the same Hotel as a double
occupancy
So the HotelBookingID record shows 2 Persons 4 Nights
When I try to design a report (or Query) that will sum all the Nights &
Persons,
I get duplicate values.

Here is a more detailed example. This is a Double Occupancy.
Smith Sheraton Hotel In Oct 10 Out Oct 14 4 Nights 2 Persons
Jones Sheraton Hotel In Oct 10 Out Oct 14 4 Nights 2 Persons
These two people are staing in the same room
So Smith and Jones come from the Member Table & are linked to the
HotelBookings via the tblHotelBookingsToMembers. The HotelBooking Detail
is only one record, but when I design a query to show the people staying at
that
hotel I get the 2 records as shown in the above example.
That's OK I understand why.
But, Here's the problem; I have to give a report to the Hotel that sums All
the
bookings (which includes others). When I design my report to sum the Nights
and Persons to give to the hotel I get 8 Nights & 4 Persons for the above
booking

I'm beginning to think that I am going about this with a faulty method.
That's why im looking for some advice. Sorry if I confused you even more.

Thanks


"Haris Rashid" wrote in message
...
hi,

you can add the DISTINCT clause in the query serving data to the report.
It omits records that contain duplicate data in the selected fields. To be
included in the results of the query, the values for each field listed in

the
SELECT statement must be unique. For example, several employees listed in

an
Employees table may have the same last name. If two records contain Smith

in
the LastName field, the following SQL statement returns only one record

that
contains Smith:
SELECT DISTINCT
LastName
FROM Employees;

If you omit DISTINCT, this query returns both Smith records.

If the SELECT clause contains more than one field, the combination of

values
from all fields must be unique for a given record to be included in the
results.

Kind regards,
------
Haris
http://www.manage-systems.com
-----------------------------------------

"Abe" wrote:

I am having a dilemma with a Hotel Booking Project which is
a small part of a larger project.
If someone can help me with this, or refer me to a sample DB
it would be seriously appreciated!

I have my tables set up as follows.
tblMembers one to many tblHotelBookingsToMembers
tblHotelBookings one to many tblHotelBookingsToMembers
(This is setup in the same manner as the Products, Order Details,
Orders tables in the Northwind DB)

In the tblHotelBookings I have fields to capture Number of Nights,
& Persons for each booking
If two members are staying in the same room,
I book them each individually under the same HotelBooingID
in tblHotelBookings
So let's say that HotelBookingID 1001 has 3 Nights & 2 Persons.

Because each member (John & Mary) is linked to HotelBookingID 1001,
when I try to create a report or query, that sums the number of room

nights
and persons, I get duplicate values. 6 nights & 4 persons

Essentially I am trying to figure out how I can book two Members into
the same hotel (specific room #s aren't captured) so that each member

has
a booking in my DB and I can design a report that will show the number

of
persons & nights for each booking without duplicates. This info has to

be
passed on to the Hotel.
Lets see if I can be more clear...
If one member (John) is booked, but has a second person (i.e. Spouse)
staying with him who is NOT a Member, then I do NOT need to
show a booking for that second person in my DB.
I simply indicate 2 persons. So I only have ONE booking. No problem.
But if his spouse is a member then I must also book that person into the

DB,
which creates 2 members for the same HotelBookingID

Any advice or help is welcome!
Thank You!

PS: If more clarity is needed, feel free to indicate so.