SELECT vals.id, vals.value FROM attributes_values AS vals LEFT JOIN goods ON vals.good=goods.id LEFT JOIN categories ON goods.category=categories.id WHERE vals.attribute= 1 AND vals.value != '' AND goods.deleted=0 AND goods.status=1 AND goods.social=0 AND categories.id IN () GROUP BY value ;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 ') GROUP BY value' at line 7