Skip to content

Instantly share code, notes, and snippets.

@voltgister
Created February 4, 2016 17:23
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 voltgister/9ebc1be9c0bc23bceb23 to your computer and use it in GitHub Desktop.
Save voltgister/9ebc1be9c0bc23bceb23 to your computer and use it in GitHub Desktop.
-- Given the id of a particular point, which points are within 1000
-- meters of that point?
select d2.id
from devices as d1
inner join devices as d2
on distance(d1.location, d2.location) <= 1000
where d1.id = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment