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 f.id!= ORDER BY f.list LIMIT 5' at line 7


SELECT
distinct f.path, f.name
FROM
files as f
LEFT JOIN objects_files as of on (of.id_file = f.id)
WHERE
of.id_object = AND f.id!=

ORDER BY f.list

LIMIT 5

;