612.(Medium)平面上的最近距离
Solution
select round(sqrt(min(pow(abs(a.x-b.x),2)+pow(abs(a.y-b.y),2))),2) shortest
from point_2d a left join point_2d b on (a.x,a.y) != (b.x,b.y); --除自己之外的笛卡尔积Last updated
select round(sqrt(min(pow(abs(a.x-b.x),2)+pow(abs(a.y-b.y),2))),2) shortest
from point_2d a left join point_2d b on (a.x,a.y) != (b.x,b.y); --除自己之外的笛卡尔积Last updated