Sql根据经纬度算出距离
程序员文章站
2022-09-10 23:44:34
SELECT ISNULL((2 * 6378.137 * ASIN(SQRT(POWER(SIN((117.223372- ISNULL(Latitude,0) )*PI()/360),2)+COS(117.223372*PI()/180)*COS(117.223372*PI()/180)*POW ......
SELECT ISNULL((2 * 6378.137 * ASIN(SQRT(POWER(SIN((117.223372- ISNULL(Latitude,0) )*PI()/360),2)+COS(117.223372*PI()/180)*COS(117.223372*PI()/180)*POWER(SIN((117.223372- ISNULL(Longitude,0) )*PI()/360),2)))),0) AS Distance FROM RequirementOrder r where r.RequirementOrderID not in (SELECT O.RequirementOrderID from OrdersDetail O)