MySQL calculate distance between two latitude/longitude coordinates

–Returns the distance in kilometers, assuming an earth radius of 6,371 km.

SELECT D.idx,D.name,( 6371 * ACOS( COS( RADIANS(C.latitude) ) * COS( RADIANS( D.latitude ) ) * COS( RADIANS( D.longitude ) - RADIANS(C.longitude) ) + SIN( RADIANS(C.latitude) ) * SIN( RADIANS( D.latitude ) ) ) ) AS kms
FROM dealers D,cities C
	GROUP BY D.idx
	ORDER BY kms 

// you need to have co-ordinates of 2 places (in this case it is dealer location and city)

81 thoughts on “MySQL calculate distance between two latitude/longitude coordinates

  1. Pingback: Google
  2. Pingback: 토토사이트
  3. Pingback: 사다리사이트
  4. Pingback: 먹튀검증
  5. Pingback: 안전놀이터
  6. Pingback: realistic vibrator
  7. Pingback: first dildo
  8. Pingback: Google
  9. Pingback: beast tv apk
  10. Pingback: store
  11. Pingback: double headed dong
  12. Pingback: порно чат
  13. Pingback: 메이저공원
  14. Pingback: 사설토토
  15. Pingback: cursos online
  16. Pingback: fbv cursos online
  17. Pingback: fishing equipment
  18. Pingback: bondage sex kit
  19. Pingback: kegel massager
  20. Pingback: bunny vibrator
  21. Pingback: printers
  22. Pingback: FIFA 19 Coins
  23. Pingback: Chicago SEO
  24. Pingback: Chicago SEO
  25. Pingback: detox tea
  26. Pingback: curso online
  27. Pingback: chwilówki
  28. Pingback: iphone repair
  29. Pingback: male sex sleeve
  30. Pingback: Google
  31. Pingback: bbw dildo
  32. Pingback: dildo
  33. Pingback: milking toy
  34. Pingback: website
  35. Pingback: workfromhome2019
  36. Pingback: los angeles seo
  37. Pingback: xxx
  38. Pingback: Anal
  39. Pingback: Lawn
  40. Pingback: penis enlargement
  41. Pingback: anal plugs reviews
  42. Pingback: strap on

Leave a Reply