Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
This function takes in two geospatial objects and measures the shortest distance between them, in meters, using the standard metric for distance on a sphere.
GEOGRAPHY_DISTANCE ( geo1, geo2 )
A double. The measured distance, in meters.
SELECT b.name AS neighbor,
-> ROUND(GEOGRAPHY_DISTANCE(a.shape, b.shape), 0) AS distance_from_border
-> FROM neighborhoods a, neighborhoods b
-> WHERE a.id = 2
-> ORDER BY 1;
+---------------------+----------------------+
| neighbor | distance_from_border |
+---------------------+----------------------+
| Probability Bay | 0 |
| Lower Bound Valley | 0 |
| Axiom Township | 0 |
| Elegant Island | 1935 |
| Upper Bound Hill | 5632 |
| Big Endian | 9016 |
| Little Endian | 17290 |
| Isle Zero | 17163 |
...