根据经纬度和公里范围检索附近所有资源

来源:互联网 发布:网络龙虎斗赌博揭秘 编辑:程序博客网 时间:2024/06/10 13:56

var sql = ‘SELECT *,’+
‘ROUND(6378.138*2*ASIN(SQRT(POW(SIN((‘+lat+’*PI()/180-store_position_y*PI()/180)/2),2)+COS(‘+lat+’*PI()/180)*COS(store_position_y*PI()/180)*POW(SIN((‘+lng+’*PI()/180-store_position_x*PI()/180)/2),2)))*1000)’+
‘AS distance FROM store where is_delete = 0 and store_name like “%’+searchInput+’%” ORDER BY distance asc LIMIT ‘+pageIndex*10+’ , ‘+pageNumber;

1 0