Sql根据经纬度算出距离

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)

posted @ 2018-03-21 11:49  _大维维  阅读(1272)  评论(1编辑  收藏  举报