Quote:
Originally Posted by mat41
I probably didnt explain myself all that well. Yes you will get the physical address from the addresses table. Of course this is the only table where the text string of the address sits. The customerAddresses table only stores the ID. As I said all three table are related and have relationships. When customer places an order you will I assume need to ask them which one of thier multiple addresses they wish to be billed? therefore get the address from the address table. I would link orders to both tables and I would get the address like so:
SELECT addresses.physicalAddress FROM (((addresses
LEFT OUTER JOIN customerAddresses ON addresses.ID = customerAddresses.addressID)
LEFT OUTER JOIN orders ON customerAddresses.addressID = orders.billingAddress)
WHERE Orders.ID = " & ThecustomerAddressesID & ";"
The ThecustomerAddressesID variable would be identified by the customerID and the billingAddress they instructed the bill to be sent to
|
If I understand you correctly you are saying that the BillingAddressID field on the orders table should store the ID of the CustomerAddressesXref table (which points to the Addresses table) instead of storing the AddressID on the addresses table.
Is this the standard approach DBA's use when setting up constraints against a many to many relationship?
Thanks so much for the help.