经纬度距离排序

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

  

上一篇:PAT Advanced 1092 To Buy or Not to Buy (20分)


下一篇:校园商铺-6店铺编辑列表和列表功能-1店铺信息编辑之Dao层开发