Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. /* Get the point of interest's geometry and save it in a common table expression */
  2. WITH point_of_interest AS (
  3. SELECT
  4. geom
  5. FROM
  6. my_table
  7. WHERE
  8. id = 1
  9. )
  10.  
  11. /* Select everything from all the other points if they are within 100m */
  12. SELECT
  13. mt.*
  14. FROM
  15. my_table AS mt,
  16. point_of_interest AS poi
  17. WHERE
  18. id != 1 -- Don't return the point of interest itself
  19. AND
  20. ST_DWithin(poi.geom, mt.geom, 100) -- Return only the points within 100 m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement