OK, I know this may sound like some easy problem that can be solved with a little thought but I seem to have writers block except with my coding and setup.
Problem:
I have a MySql DB, having information relating to certain service providers in my area... including company name, address, zipcode, latitude and longitude (to be used for distance calculations)
Problem 2:
How would I go about writing a query for such:
Approximate distance in miles = sqrt(x x + y y)
where
x = 69.1 (zip2.lat - zip1.lat)
and
y = 53 (zip2.lon - zip1.lon)
Where zip1 would be the customer zip and zip 2 the zip of some service provider and I want to return those that provide the particular service that are closest to the customer.
Problem 3:
Would I need two seperate tables of information for this calculation?
Should my select be using a while statement with the formula as the conditional?
Please help... I am so confused at this point that no amount of thought on my part is making sense. Thanks so much David