Hello all, I am trying ot create a db that will allow me to tract commissions from various brokers and customers. I have created all the tables from much larger ones out of MAS90(an accounting program) and thought I normalized all the tables correctly. When I tried to run the query that will give me the commission rates I am looking for it does not work. I don't think my problem is in the query but in the relationships between the tables used in the query. I have included below the shorthand schema describing the tables involved and the business rules. Keep reading and you should understand my question more.
BROKER(BrokerId, BFName, BLName, BPhone)
CUSTOMER(Cust#, CustName, CAddress, CCity, CState, CZip, CPhone)
INVOICE(Invoice#, InvoiceDate, InvoiceTotal, ItemNumber, Customer#) Customer# is FK
PRODUCT(Item#, ItemDescription, ProductLine)
RATE(Cust#, BrokerID, ProductLine, Comm, StateDate) Cust# and BrokerID are FK's
For the rate table, there are many combinations of cust#, brokerID, and ProductLine that is why they are all part of the composite primary key. The combination of ProductLine and Cust# determines both the Broker and the CommRate for each broker involved. There are a handful of instances where there are two or more brokers to one invoice, so I want to CommRate to be determined by the ProductLine and Cust#. I want the Broker to be shown based on this so I can create a report detailing each brokers sales.
Access will not let me create a one-to-many relationship between the Rate.ProductLine and Product.ProductLine.
Below are the business rules the best I can explain them.
Business Rules:
One Customer per invoice, many invoices per customer
One or many brokers per invoice, many invoices per broker
One product line per invoice, many invoices per product line
one item number per invoice, many invoices per item number
one product line per item number, many item numbers per product line
I have one to many relationships between the following entities:
customer.customer# and rate.customer#
broker.brokerID and rate.brokerID
product.itemnumber and invoice.itemnumber
If anyone can see what i need to do either to continue cormalizing or something I would greatly appreciate it. I have been working on this for a while now and would love to be able to finsih it soon.
BROKER(BrokerId, BFName, BLName, BPhone)
CUSTOMER(Cust#, CustName, CAddress, CCity, CState, CZip, CPhone)
INVOICE(Invoice#, InvoiceDate, InvoiceTotal, ItemNumber, Customer#) Customer# is FK
PRODUCT(Item#, ItemDescription, ProductLine)
RATE(Cust#, BrokerID, ProductLine, Comm, StateDate) Cust# and BrokerID are FK's
For the rate table, there are many combinations of cust#, brokerID, and ProductLine that is why they are all part of the composite primary key. The combination of ProductLine and Cust# determines both the Broker and the CommRate for each broker involved. There are a handful of instances where there are two or more brokers to one invoice, so I want to CommRate to be determined by the ProductLine and Cust#. I want the Broker to be shown based on this so I can create a report detailing each brokers sales.
Access will not let me create a one-to-many relationship between the Rate.ProductLine and Product.ProductLine.
Below are the business rules the best I can explain them.
Business Rules:
One Customer per invoice, many invoices per customer
One or many brokers per invoice, many invoices per broker
One product line per invoice, many invoices per product line
one item number per invoice, many invoices per item number
one product line per item number, many item numbers per product line
I have one to many relationships between the following entities:
customer.customer# and rate.customer#
broker.brokerID and rate.brokerID
product.itemnumber and invoice.itemnumber
If anyone can see what i need to do either to continue cormalizing or something I would greatly appreciate it. I have been working on this for a while now and would love to be able to finsih it soon.