Dale Massicotte
asked on
Need help creating a complex query and/or junction table
So here goes...
I have a table 'Customers'
main fields needed are:
ID, CompanyName, Street, City, State, Zip
I suppose I need another table 'DurationMiles' with the following fields:
ID, ForeignID1, ForeignID2, Miles, Duration
So each record in DurationMiles will contain 2 foreign ID's (2 distinct records) from the Customers table so that I can use another program (Mappoint) to calculate the distance and duration between the 2 records in the 'Customers' table
Is this the correct approach? I will need to also know how to use the junction table or query to get the miles and duration.
I have a table 'Customers'
main fields needed are:
ID, CompanyName, Street, City, State, Zip
I suppose I need another table 'DurationMiles' with the following fields:
ID, ForeignID1, ForeignID2, Miles, Duration
So each record in DurationMiles will contain 2 foreign ID's (2 distinct records) from the Customers table so that I can use another program (Mappoint) to calculate the distance and duration between the 2 records in the 'Customers' table
Is this the correct approach? I will need to also know how to use the junction table or query to get the miles and duration.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
DurationMiles.ID = Customers.ID"
Not currently
"What kind of values are going to be in the ForeignID1 and ForeignID2 fields? I'm asking because I'm wondering if you really need to create 2 records in the DurationMiles table for each Customer in order to perform this calculation (from Mapppoint). "
I was thinking that the two foreign ID's in the DurationMiles table would be 2 records of the ID in the Customers table.