cancel
Showing results for 
Search instead for 
Did you mean: 

Product Edit SQL Error

Product Edit SQL Error

Hi,

I see this error when editor wants to edit product:

 

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

 

I suppose it's due to empty WHERE section of sql statement, but i'm not sure why it's happening? It was working fine and it happens today.

 

1 REPLY 1

Re: Product Edit SQL Error

I shif back the database to a few days back and check the equal sql statement, it is:

SELECT DISTINCT p.entity_id FROM `catalog_product_entity` AS `p`
 INNER JOIN `catalog_product_flat_4` AS `cpf` ON cpf.entity_id = p.entity_id
 LEFT JOIN `catalog_category_product` AS `ccp` ON ccp.product_id = p.entity_id WHERE ( (`ccp`.`category_id` IN ('68')) ) AND (p.entity_id = '3671') LIMIT 1

As you see this is the part that missing from sql statement:

`ccp`.`category_id` IN ('68')

The category id=68 exist in the list of categories, any idea what's missing here caused this error?