I have a SQL database where I store longitude and latitude from an iPhone application. I need to query all the records starting from a given location to the other far most location. 

For example, I have longitude x and latitude y. I want all the records first whose longitude matches x the most closely and whose latitude matches y the most closely. I need to all the records one by one in the chain from nearest to farthest. The more distant the location, the greater the value of longitude and latitude will be than x and y.

I hope you got the point and I am waiting for the answer.