I have many points in a table. I want to show points near one point. Buffer area can be 10 or 100 in SQL Server using SQL query.
You will need to have a unique identifier column in your table. Here I called it
id, and also refer to the table as
my_table. I also assume that the point of interest has an
/* 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