I am writing from two varChar formatted columns named 'lattitude' and 'longitude' to a Point formatted column named 'coordinate' using the statement below.
"UPDATE table_name SET coordinate = PointFromText(CONCAT('POINT(',table_name.longitude,' ',table_name.lattitude,')'))"
I attempting to do a spatial query on the coordinate column using the following statement.
SELECT id , coordinate FROM table_name WHERE MBRContains(GeomFromText('Polygon(-126.728566 49.226434, -123.652395 23.586457,-56.679738 23.908252,-53.076223 55.243002)'), coordinate)
According to this tool the polygon in my query covers the entire U.S. I know there are points in my table that fall in the U.S. but I am still not getting any results (note I'm getting a null result not an error). Any ideas as to what I'm doing wrong?
UPDATE. Below is an updated attempt at executing my query per the suggestion below.
SET @g1 = GeomFromText('Polygon((23.586457 -123.652395,23.908252 -56.679738,55.243002 -53.076223,55.243002 -53.076223,23.586457 -123.652395))');
SELECT id , coordinate FROM table_name WHERE MBRContains(@g1, coordinate)