rosearlene
New member
- Local time
- Yesterday, 16:17
- Joined
- Aug 20, 2013
- Messages
- 4
Hi all,
We have a database at work that tracks all of our work (we do forms), and about 6 years ago we were forced to restructure this db into tables that we KNEW wouldn't work. Well, it's 6 years later, and we've finally convinced the powers that be, that we need to re-do this db in order to get functionality.
I can go into details...but here's the scenario (using the "Northwinds" example). Let's say that we are a manufacturer, and we have a table that holds all of our customers. That table, SHOULD be the main table, and every order that the customer puts in, should all relate back to the customer IDKey. Then....for each order, there are multiple statuses.
Well, our db is set up that the Orders table is the main table, and the customer ID is but a field in that table. All of the statues for each order are related to the Order table, not the Customer.
Whenever we try to get the latest status of something, we end up getting duplicate records, because we see ALL of the orders from Customer XYZ (dating back to when the dinosaurs roamed the earth), instead of seeing Customer XYZ, and just the information for the latest order.
Is there an EASY way to change the structure so that the Customer table becomes primary, and all of the Orders AND their statuses match up correctly? At this point, we think we need to start fresh, and backload data.
Summary - there is a Customer table w/ unique IDs. The relationship for Customer to Orders is one-to-many; and then the relationship for Orders to Status is again....one-to-many.
We want to be able to pull a query that shows is all of the customers, their most recent order, and the most recent status of that order.
Any ideas? Or did I confuse everyone? ;-)
Oh! And I forgot the most important thing. The database itself has NO relationships. We had to use ASP runner to put it on our intranet, and all of the relationships exist in that program. So we basically have a bunch of unrelated tables.
We have a database at work that tracks all of our work (we do forms), and about 6 years ago we were forced to restructure this db into tables that we KNEW wouldn't work. Well, it's 6 years later, and we've finally convinced the powers that be, that we need to re-do this db in order to get functionality.
I can go into details...but here's the scenario (using the "Northwinds" example). Let's say that we are a manufacturer, and we have a table that holds all of our customers. That table, SHOULD be the main table, and every order that the customer puts in, should all relate back to the customer IDKey. Then....for each order, there are multiple statuses.
Well, our db is set up that the Orders table is the main table, and the customer ID is but a field in that table. All of the statues for each order are related to the Order table, not the Customer.
Whenever we try to get the latest status of something, we end up getting duplicate records, because we see ALL of the orders from Customer XYZ (dating back to when the dinosaurs roamed the earth), instead of seeing Customer XYZ, and just the information for the latest order.
Is there an EASY way to change the structure so that the Customer table becomes primary, and all of the Orders AND their statuses match up correctly? At this point, we think we need to start fresh, and backload data.
Summary - there is a Customer table w/ unique IDs. The relationship for Customer to Orders is one-to-many; and then the relationship for Orders to Status is again....one-to-many.
We want to be able to pull a query that shows is all of the customers, their most recent order, and the most recent status of that order.
Any ideas? Or did I confuse everyone? ;-)
Oh! And I forgot the most important thing. The database itself has NO relationships. We had to use ASP runner to put it on our intranet, and all of the relationships exist in that program. So we basically have a bunch of unrelated tables.
Last edited: