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 experts.is_live = 1 AND experts.type = 'travel'' at line 5 SELECT experts.* FROM standalones INNER JOIN experts__standalones USING(standalone_id) INNER JOIN experts USING(expert_id) WHERE standalone_id IN () AND experts.is_live = 1 AND experts.type = 'travel'