Filter closest addresses from latitude & longitud
Hi, I have a list of business address with latitude & longitude, I am trying to filter just the ones near a specific coordinate.
I am trying to achieve with an SQL query:
SELECT
id,
(
cos(radians(lng) -
radians(-122)) +
sin(radians(lat )))
) AS distance
FROM "markers"
HAVING distance < 28
ORDER BY distance LIMIT 0, 20;
When I try this on a SQL server, everything it's working fine, but I am getting wrong distance when I run the code inside a SQL query over Zoho Analytics.
What I am doing wrong?
Thank you