>>I have a table of warrants with latitude and longitude, and I would like to be able to select all warrants within a given radius. I know I've seen this discussed before. Any of you math professors got a clue?
>
>hhmmmm, this calls for pythagoras...
>
>lets say your on position xPos and Ypos and your the location is at xDest and YDest, and your radius is nRad, I'd go for the following solution
>
>
SELECT * FROM Warrants WHERE SQRT((xPos - xDest) ^ 2 + (Ypos - yDest) ^ 2) =< nRad
>
>If its getting to slow you can think of adding additional for the benefit of rushmore like:
>
>
AND xdest BETWEEN xPos - nRad AND xPos + Rad AND yDest BETWEEN yPos - nRad AND yPos + nRad
>
>of course you need indexes on xDest and yDest
>
>Walter,
Thanks Walter, I'll give it a try.
John Harvey
Shelbynet.com
"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright