经纬度距离排序

select * from (select shop_id,shop_name,shop_address,shop_avatar,ROUND(6378.138*2*ASIN(SQRT(POW(SIN(($latitude*PI()/180-`shop_lat`*PI()/180)/2),2)+COS($latitude*PI()/180)*COS(`shop_lat`*PI()/180)*POW(SIN(($longitude*PI()/180-`shop_lon`*PI()/180)/2),2)))*1000) AS distance from ns_shop order by distance ) as a limit 1

  

猜你喜欢

转载自www.cnblogs.com/tangqi9602/p/12179900.html