MySQL Error Occurred

Error Message:
1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1

SQL:
SELECT I.* FROM page_versions AS p INNER JOIN file AS I on p.MainImageID = I.ID WHERE p.RecordID =