Error en SELECT tpoblacion.nombrePoblacion, tpoblacion.nombreLocal, tpoblacion.idPoblacion FROM tpoblacion INNER JOIN tcomarca ON tcomarca.idComarca = tpoblacion.idComarca WHERE tcomarca.idComarca = AND tpoblacion.idpedania = 0 ORDER BY tpoblacion.nombrePoblacion: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND tpoblacion.idpedania = 0 ORDER BY tpoblacion.nombrePoblacion' at line 4