代码语言:javascript复制
select round(
pow(pow(p1.x-p2.x,2) pow(p1.y-p2.y,2),1/2),2
) shortest
from point_2d p1
inner join point_2d p2
where p1.x<>p2.x
or p1.y<>p2.y
order by 1 asc
limit 1