Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Get the point of interest's geometry and save it in a common table expression */
- WITH point_of_interest AS (
- SELECT
- geom
- FROM
- my_table
- WHERE
- id = 1
- )
- /* Select everything from all the other points if they are within 100m */
- SELECT
- mt.*
- FROM
- my_table AS mt,
- point_of_interest AS poi
- WHERE
- id != 1 -- Don't return the point of interest itself
- AND
- ST_DWithin(poi.geom, mt.geom, 100) -- Return only the points within 100 m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement