Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 27 May 2005 @ 14:18:37 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Distance based on latitude and longitude
 
From:   Ford, Jim

Here's the formula. The join is the problem.

     ***********************************
      * THE EARTH RADIUS - 3963 MILES  *
      * LATITUDE1        - 35.25927    *
      * LATITUDE2        - 35.22143    *
      * LONGTITUDE1      - -81.2238    *
      * LONGTITUDE2      - -81.1492    *
      **********************************

     SELECT 3963*(ACOS(COS(35.25927*3.14159/180)*COS(35.22143*3.14159/180)*
                        COS((3.14159/180)*(-81.2238-(-81.1492)))+
                        SIN(35.25927*3.14159/180)*SIN(35.22143*3.14159/180)))
                        (FORMAT 'ZZZ9.99') AS MILES
        FROM  VDWMCT.BCENTR
     GROUP BY 1;


      *** Query completed. One row found. One column returned.
      *** Total elapsed time was 0.36 seconds.


       MILES
     -------
        4.96


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023