With the advent of GPS and other widely available global location data, there is an increasing need to be able to accurately calculate the distance between two points over the earth's surface, from latitudes and longitudes. This SQL function does just that ,returning the distance in miles.
this function has several other advantages as well, first, it is very accurate, usually 4 to 5 decimal places. and secondly, it is much faster than most other, less accurate, algorithims. (if even more speed is needed, then include this calculation in-line in the body of your query.)