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
ASp
INNER JOINcatalog_product_flat_1
AScpf
ON cpf.entity_id = p.entity_id LEFT JOINcatalog_category_product
ASccp
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..
app\code\core\Mage\Rule\Model\Resource\Abstract.php
public function getProductFlatSelect($storeId, $condition)
{
$select = $this->_getReadAdapter()->select();
$select->from(
array('p' => $this->getTable('catalog/product')),
array(new Zend_Db_Expr('DISTINCT p.entity_id'))
)
->joinInner(
array('cpf' => $this->getTable('catalog/product_flat') . '_' . $storeId),
'cpf.entity_id = p.entity_id',
array()
)->joinLeft(
array('ccp' => $this->getTable('catalog/category_product')),
'ccp.product_id = p.entity_id',
array()
);
$where = $condition->prepareConditionSql();
if (!empty($where)) {
$select->where($where);
}
return $select;
}