If this is not very important, and I assume that you have an x and y column in your table, just select all the rows in the large bounding box and use pythagorus (or Haversine) to crop leads to corners.
eg. select * from the places where (x between xpos-10 miles and xpos + 10miles) and (y between xpos -10miles and ypos + 10miles).
Remember that pythagorus is sqrt (x_dist ^ 2 + y_dist ^ 2).
Its quick and simple, easy to understand and does not need funny connections.
source
share