I have multiple pairs of cartesian coordinates (X,Y) calculated by user input (php), which form a range (picture a polygon).
From my database (600 points), I need to find any points that fall within that range (within the polygon), and exclude any that are outside that range.
I would like to do it all in one SQL statement, but I can't seem to get my head around the logic of matching two different values - to two different columns - of the same row.
I suppose I split the data between two tables and use an inner join? But this seems a bit over the top.
I have tried playing with the geometry part of MYSQL (trying to search coord pairs using the "point" datatype), but I cannot see the data I have imported (after a successful import). And when I select all data from a row try and display $row["coords"] (which should be the point data), all I get is a bunch of weird ASCII characters and squares...
So hopefully there is an easy way to do it using regular SQL.