nelsonm - 11:59 pm on Nov 20, 2010 (gmt 0)
I have a US zipcode database table that's used to select zipcodes in a business table that are within a 20 mile radius of the base zipcode that the user enters.
The data is used to calculate the distance between the base zipcode and all the selected business table zipcodes, is in US zipcode table.
I want to be able to sort on business table zipcode and distance before displaying, unfortunately, the distance is not stored in any table because it has to be calculated.
So... my question is... is it more correct to create a separate distance table to store and point the calculated distance (from the base zipcode to the selected zipcode) to the proper record in the business table. Then join the two tables for sorting before displaying.
Is it better to just add a distance field to the business table then update each business table record with the calculated distance. Then i can sort the business table zipcode and distance fields before displaying.
Either way, the distance field in either the distance or business table will have to cleared every time the user enters a new base zipcode.
What do you think?