deeejay

SQL to calculate distance between LAT LONG

Nov 20th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.41 KB | None | 0 0
  1. [Longitude OF START point] may have TO manually enter
  2. [Lattitude OF START point] may have TO manually enter
  3.  
  4. [latitude] USE latitude FROM DATA SET
  5. [longitude] USE FROM DATA SET
  6.  
  7.  
  8. ACOS( SIN([Longitude OF START point]*PI()/180)*SIN([latitude]*PI()/180) + COS([Longitude OF START point]*PI()/180)*COS([latitude]*PI()/180)*COS([longitude]*PI()/180-([Lattitude OF START point])*PI()/180) ) * ((6371*2)/3) AS [Distance]
Advertisement
Add Comment
Please, Sign In to add comment