SELECT pcl.id, pcl.product_id FROM pcstore_products_characteristics_links AS pcl LEFT JOIN pcstore_products_characteristics AS pc ON pc.id=pcl.char_id LEFT JOIN pcstore_products_1 AS p ON p.id=pcl.product_id WHERE pc.item_value BETWEEN 2.0000 AND 2.0000 AND AND pc.item_id='' AND p.visible='1' GROUP BY pcl.product_id 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 pc.item_id='' AND p.visible='1' ' at line 5