SELECT, vals.value FROM attributes_values AS vals LEFT JOIN goods ON LEFT JOIN categories ON WHERE vals.attribute= 1 AND vals.value != '' AND goods.deleted=0 AND goods.status=1 AND AND 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