title: MySQL Error: Unknown column in 'field list' PHP/MySQL
body: <p>Hey guys I have a problem with MySQL, i'm trying to insert data in a table but it's returning this error message</p>
  
  <blockquote>
    <p>Fatal error: SQL: SELECT e.idtarea AS 'idTarea', e.detalle AS 'detalle', e.precio AS 'precio', e.idor AS 'idOrdenReparacion', e.fecha AS 'fecha', concat( 'Editar ', 'Eliminar' ) AS Opciones FROM Tarea e WHERE e.idtarea like '%%' ORDER BY e.idtarea;, Error: Unknown column 'e.idor' in 'field list' in /opt/lampp/htdocs/scep/tareas.php on line 76 </p>
  </blockquote>
  
  <p><strong>Here is my code:</strong></p>
  
  <pre><code>$SQL="
  
    SELECT 
      e.idtarea AS 'idTarea', 
      e.detalle AS 'detalle', 
      e.precio AS 'precio', 
      e.idor AS 'idOrdenReparacion', 
      e.fecha AS 'fecha', 
      concat('&lt;a href=\'editarTarea.php?id=',e.idtarea,'\'&gt;Editar&lt;/a&gt;&amp;nbsp;','&lt;a href=\'eliminarTarea.php?id=',e.idtarea,'\' onclick=javascript:confirm(\'Eliminar?&gt;\')&gt;Eliminar &lt;/a&gt;') AS Opciones 
    FROM Tarea e ".$FILTRAR_POR." 
    ORDER BY e.idtarea;";
  
    $RESULT = mysql_query($SQL) or trigger_error("SQL: $SQL, Error: " . mysql_error(), E_USER_ERROR); 
  </code></pre>
  
  <p><strong>Table Tarea from database:</strong></p>
  
  <pre><code>  CREATE TABLE IF NOT EXISTS `Tarea` (
     `idTarea` int(11) NOT NULL AUTO_INCREMENT,
     `detalle` varchar(45) COLLATE latin1_danish_ci DEFAULT NULL,
     `precio` varchar(45) COLLATE latin1_danish_ci DEFAULT NULL,
     `idOrdenReparacion` int(11) NOT NULL DEFAULT '0',
     `fecha` date DEFAULT NULL,
     PRIMARY KEY (`idTarea`,`idOrdenReparacion`),
     KEY `fk_Tarea_OrdenReparacion1_idx` (`idOrdenReparacion`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_danish_ci AUTO_INCREMENT=2 ;
  
  .....
  
    ALTER TABLE `Tarea`
    ADD CONSTRAINT `fk_Tarea_OrdenReparacion1` FOREIGN KEY (`idOrdenReparacion`) 
    REFERENCES `OrdenReparacion` (`idOrdenReparacion`) ON DELETE NO ACTION ON UPDATE NO ACTION; 
  </code></pre>
  
  <p>Any ideas?</p>