开发者

How to retrieve all rows thats co-ords are within a specifc radius in MySql Database

i am looking for a select statement that when given a specific set of co-ords(lng1+lat1) it will return a开发者_C百科ll the rows within a 1km radius of lng1+lat1? this is to work with a mysql server?

      |_id_|_lat_|lng_|
row 1 | 1  | 1.3 |5.3 |
row 2 | 2  | 1.3 |5.2 |
row 3 | 3  | 2.3 |5.9 |


select * from table where POW((_lat_-lat1),2) + POW((_lng_-lng1),2) < 1 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜