I want to update a table by using sub query in where clause but I got the exception "You can't specify target table 'catalog_category for update in FROM clause'". This is my query:
update catalog_category set `status` = "inactive"
where id_catalog_category in (
SELECT id_catalog_category
FROM catalog_category t1 where (SELECT status
FROM catalog_category t2
WHERE t2.lft < t1.lft AND t2.rgt > t1.rgt
ORDER BY t2.rgt-t2.lft ASC limit 1) = 'active' and status = 'inherited_inactive')
Is there any way that I can fix this error?