Skip to content

Instantly share code, notes, and snippets.

@speeddragon
Created February 13, 2019 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save speeddragon/987eb822f7a4dd0e9da9db542d380f7d to your computer and use it in GitHub Desktop.
Save speeddragon/987eb822f7a4dd0e9da9db542d380f7d to your computer and use it in GitHub Desktop.
SELECT id, ST_Distance_Sphere(ST_MakePoint(112.15769, 25.28552), r0."location") AS distance
FROM "restaurant" AS r0
WHERE ST_Distance_Sphere(ST_MakePoint(112.15769, 25.28552), r0.location) < 400
ORDER BY distance
LIMIT 20 OFFSET 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment