Error: 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 ') GROUP BY products.id ORDER BY sort ASC LIMIT 0, 12' at line 7 - SELECT products.*, CASE WHEN products.category_id <> 3566 THEN product_categories.sort ELSE products.sort END AS sort FROM product_categories RIGHT JOIN products ON product_categories.product_id = products.id INNER JOIN product_sites ON product_sites.product_id = products.id WHERE status_id = 1 AND site_id = 1 AND (products.category_id = 3566 OR product_categories.category_id = 3566) AND products.id IN () GROUP BY products.id ORDER BY sort ASC LIMIT 0, 12