please reference objects by name, the first query will vary according to sort order.
it absolutely does not, you must have inadvertently altered something, saved the query and then saved the database.
totally irrelevant.
I spent a few minutes googling, found a number of formulas, tested a few and made my choice based on accuracy.
.
you have not provided a single piece of detail as regards your database:
table name, field names, field types.
a copy of the SQL used in your query.
.
I live in the UK and therefore used UK locations along with their coordinates.
fixed location was ‘Newcastle upon Tyne’, latitude = 54.966667, longitude = -1.600000.
I verified my results here: Distance Calculator
.
I also tested your formula in my query, the results were wildly inaccurate which infers that your spreadsheet is also pushing out garbage.
.
your topic is not complex:
just 3 relevant fields “Location”, “Latitude” and “Longitude”.
if you are unable to integrate the query “qAirMiles” into your db then upload your database.
--qAirMiles
--literal coords are for Newcastle
--shows air miles from Newcastle to all destinations
select
"Location"
,
acos((sin(radians(54.966667)) * sin(radians("Latitude"))) + (cos(radians(54.966667)) *
cos(radians("Latitude"))) * (cos(radians("Longitude") - radians(-1.600000)))) * 6371 km
,
acos((sin(radians(54.966667)) * sin(radians("Latitude"))) + (cos(radians(54.966667)) *
cos(radians("Latitude"))) * (cos(radians("Longitude") - radians(-1.600000)))) * 3958.8 miles
,
sqrt(power(54.966667 - "Latitude",2) + power(-1.6 - "Longitude",2)) * 100 users_formula
from
"tGPS"
order by km