SQL query: Documentation SELECT se.election_id, su.user_id FROM samosa_elections se, samosa_assoc_users_elections saue, samosa_users su WHERE se.election_id = saue.election_id AND saue.user_id = su.user_id LEFT JOIN ( SELECT se.election_id, su.user_id FROM se, samosa_assoc_groups_elections sage, samosa_groups sg, samosa_assoc_groups_users sagu, su WHERE se.election_id = sage.election_id AND sage.group_id = sg.group_id AND sg.group_id = sagu.group_id AND sagu.user_id = su.user_id )table1 USING ( user_id ) LIMIT 0 , 30; MySQL said: Documentation #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 'LEFT JOIN ( SELECT se . election_id , su . user_id FROM se , samosa_assoc_group' at line 1