Problem with a query

  • Thread starter Thread starter Aleksei
  • Start date Start date
A

Aleksei

Hi!
I have a db of the hotel. Hotel can provide different services, and the
client can use different services (1 and more). Each service has its price.
So i have the following tables:
1) ID
Client
ServiceName
Date
2) ServiceID
ServiceName
Price
I need a query that will show client and total cost of services he used - is
it possible?

Thanks in avance for the answer!
 
Aleksei

I suspect that you have a many-to-many relationship. Each Client can have
one-to-many Services, but each Service can have one-to-many Clients. To
manage this, you need a third table, a resolver/junction/relation table
(?trelClientService) that holds one row for each valid combination of Client
and Service. This third table is where you record who has what service.

You'd use a query that joined this third table back to the other two to get
the ClientName and the ServicePrice.
 
Back
Top