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 par_resultado IS NOT NULL and par_tipo = 0 ORDER BY fix_fecha_cam DESC, f' at line 2