Skip to content

Instantly share code, notes, and snippets.

@imrealashu
Last active December 27, 2017 16:31
Show Gist options
  • Save imrealashu/4cf8f4625768e7345bf23b2025c78f99 to your computer and use it in GitHub Desktop.
Save imrealashu/4cf8f4625768e7345bf23b2025c78f99 to your computer and use it in GitHub Desktop.
Mysql raw query for spacial distance calculations.
SELECT *,
ST_DISTANCE_SPHERE(
POINT(`table_name`.`lat`, `table_name`.`lng`),
POINT('24.2449530', '85.4870880')) as `distance`
FROM `table_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment