2021年4月29日星期四

Finding the pair of coordinates closest to each other using SQL

Given a list of coordinates, how can I find the closest pair of coordinates using only ONE SQL statement? I have been stuck on this question for a while now and haven't managed to come up with any ideas yet. Since I'm only allowed to use one sql statement I assume variables are not allowed too.

for visualization:

id lat long  1  -12 35   2  -1  100  3  -9  3  
https://stackoverflow.com/questions/67327302/finding-the-pair-of-coordinates-closest-to-each-other-using-sql April 30, 2021 at 10:07AM

没有评论:

发表评论