2017-01-27 1 views
-1

위도와 경도가있는 두 개의 데이터베이스가 있습니다. 나는 마스터 6000 (모든 고유) 데이터를 가지고있는 것처럼 내가 두 번째 데이터베이스를 실행해야합니다 (데이터베이스 B)액세스 2016 위도 경도 쿼리

두 번째 데이터베이스를 비교하는 비교하고 마스터 데이터베이스 (데이터베이스 A)에서 가장 가까운 지점을 찾을 필요 ((150) 데이터)를 찾고 마스터 데이터베이스에서 가장 가까운 150 좌표를 찾습니다.

답변

-1
 
You can use this query to find the distance between two points. For each point from DB1 find distance between points in DB2 and select min distance point. 

This Query will give distance in KM, 

Please note that this query you need to rewrite to make compatible with MSAccess DB. 

ROUND(
    (
     (
     (
      ACOS(
      SIN((from.latitude * PI()/180)) * SIN((to.latitude * PI()/180)) 
+ COS((from.latitude * PI()/180)) * COS((to.latitude * PI()/180)) 
* COS(((from.longitude- to.longitude) * PI()/180)) 
     ) 
     ) * 180/PI() 
    ) * 60 * 1.1515 
    ) * 1.609344, 
    2 
) AS distance