Hey, guys,
I'm trying to figure out how to select data from a MySQL table based of closeness to a number. Here's what I mean.
I'm writing an application that stores the coordinates of places (longitude and latitude) what I'd like to be able to do is select data from the database based on the location of where the user is. So, say, for example, I've got three locations in the database: [(-70.425, 45.836), (-74.234, 41.639), (-75.747, 41.836)], and the user's location is (-74.345, 41.625). I'd like to be able to select the entries so that they spread out according to distance from the user, getting the three entries in this order: [(-74.234, 41.639), (-75.747, 41.836), (-70.425, 45.836)].
Is this even possible in MySQL, or am I going to have to select a few entries from the database and do the calculation in my programming language?