Problem preparing query (SELECT MAX(p.precio_lista_sin_iva) AS precioMaximo FROM `productos_portafolio` pf LEFT JOIN `productos` p ON (pf.`id_producto`=p.`id_producto`) LEFT JOIN `productos_x_categoria` c ON (c.`id_producto`=p.`id_producto`) WHERE c.`id_categoria`= AND p.status="1" AND pf.`status`="1") 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 p.status="1" AND pf.`status`="1"' at line 1