title: Search a table for Point in Polygon using MySQL
body: <p>I have create a table (municipal_border), in MySQL 5.5, that holds some boundaries.</p>
  
  <pre><code>CREATE TABLE `municipal_border` (
    `boundary` polygon NOT NULL,
    `municipalID` int(10) NOT NULL,
  ) ENGINE=InnoDB
  </code></pre>
  
  <p>The field municipalID is not unique.</p>
  
  <p>I'm using the code below to test if a point belongs into a polygon.</p>
  
  <pre><code>set @r = (SELECT municipal_border.boundary FROM municipal_border WHERE municipalID=9001);
  set @p = GeomFromText('POINT(24.1621 41.0548)');
  select if(contains(@r, @p), 'yes', 'no');
  </code></pre>
  
  <p>The first statement set @r = ... returns just one row and I selected it specially for testing.
  It works just great.</p>
  
  <p>What I want to do is to search the whole table (erasing, in other words, the WHERE part from the SQL question) and find in which polygon the point is in.</p>