Shortest Distance in a Plane



@Mr.Bin Right. I mean the " (p1.x <= p2.x AND p1.y <=p2.y)
and (p1.x != p2.x or p1.y != p2.y)" part after "ON" for join clause. This will only return n*(n1)/2 points.