数据库根据经纬度排序查询

SELECT t.storename,
       t.storejing,
       t.storewei,
       (round(6378138 * 2 * asin(sqrt(power(sin(((t.storewei * acos(-1)) / 180 -
                                                (39.89654541015625 * acos(-1)) / 180) / 2),
                                            2) + cos((39.89654541015625 * acos(-1)) / 180) *
                                      cos((t.storewei * acos(-1)) / 180) *
                                      power(sin(((t.storejing * acos(-1)) / 180 -
                                                           (116.4852523803711 * acos(-1)) / 180) / 2),
                                                       2))))) AS distance
  FROM BUSINESS_STORE t
 ORDER BY distance asc;

猜你喜欢

转载自blog.csdn.net/fight_man8866/article/details/80677252