MySQL 两个经纬度之间的距离由近及远排序

select *,(2 * 6378.137* ASIN(
SQRT(
POW(SIN(PI()*(39.911688-angps_y)/360),2)
+
COS(PI()*39.911688/180)* COS(angps_y * PI()/180)*POW(SIN(PI()*(116.47727-angps_x)/360),2)
)
)
) as distance from PRO_SHOP
order by distance asc limit 1,20

猜你喜欢

转载自longxzq-126-com.iteye.com/blog/1888901