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.id_produto <> 0 AND I.codigo_interno='pt' group by P.id_produto ORDE' at line 5