SQLSTATE[42000]: Syntax error or access violation: 1064 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 main = 1' at line 4, query was: SELECT v.* FROM cms_video_has_cms_athlete INNER JOIN cms_video as v ON cms_video_has_cms_athlete.cms_video_id = v.id WHERE cms_athlete_id = AND main = 1