I am facing an issue after re-indexing not able to add or edit product and old products are not showing.

SQLSTATE[42000]: Syntax error or access violation: 1064 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 ') ) ) AND (p.entity_id = '2112') LIMIT 1' at line 3, query was: SELECT DISTINCT p.entity_id FROM catalog_product_entity AS p INNER JOIN catalog_product_flat_1 AS cpf ON cpf.entity_id = p.entity_id LEFT JOIN catalog_category_product AS ccp ON ccp.product_id = p.entity_id WHERE ( ( (cpf.attribute_set_id='4' AND ) ) ) AND (p.entity_id = '2112') LIMIT 1

AND is 2 times, but it comes from magento core before when i didn't do re-indexing i can do edit and update there is no SQL error but after re-indexing its appears.

I Checked all the necessary things like (Status,Visibility,Qty ,Stock Availability,Product Categories,Indexes and Caches), but i am not able to add or even edit old products, or not able to view on fronted any product on detail page..


public function getProductFlatSelect($storeId, $condition)
    $select = $this->_getReadAdapter()->select();
            array('p' => $this->getTable('catalog/product')),
            array(new Zend_Db_Expr('DISTINCT p.entity_id'))
            array('cpf' => $this->getTable('catalog/product_flat') . '_' . $storeId),
            'cpf.entity_id = p.entity_id',
            array('ccp' => $this->getTable('catalog/category_product')),
            'ccp.product_id = p.entity_id',

    $where = $condition->prepareConditionSql();
    if (!empty($where)) {

    return $select;
  • Please try with disabled flat option in configuration. – Anas Mansuri Jun 19 at 9:22
  • Hi Anas, Thanks, My half issue resolve by your suggestion now I can Edit or update product.. but I can't see Product custom option on frontend... – Haseeb Iqbal Jun 19 at 21:34
  • Please check with admin panel it's exist or not. – Anas Mansuri Jun 20 at 0:16
  • All Product are exist, even i get the name of the product on detail page but not able to see Product Options... – Haseeb Iqbal Jun 20 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.