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.
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
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