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.

closed as unclear what you're asking by HDunn, Fran Raga, Vince, JGH, whyzar May 30 at 13:54

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.

  • 1
    Welcome to GIS SE. As a new user, please take the Tour, which explains how our "Focused question/Best answer" model operates. All coding questions are expected to contain code. Please Edit the question to contain your best effort and give an indication of the error you are receiving. – Vince May 30 at 10:22

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 id of 1

/* Get the point of interest's geometry and save it in a common table expression */
WITH point_of_interest AS (
        id = 1

/* Select everything from all the other points if they are within 100m */
    my_table AS mt,
    point_of_interest AS poi
    id != 1 -- Don't return the point of interest itself
    ST_DWithin(poi.geom, mt.geom, 100) -- Return only the points within 100 m

Not the answer you're looking for? Browse other questions tagged or ask your own question.