I want to update the column leaf_category
with TRUE
where the category is not a parent category. It works as a select statement:
select
c1.id, c1.name, c1.slug, c1.level, c2.parent_id, c2.name, c2.slug, c2.level
from
catalog_category c1
left outer join
catalog_category c2 on
(c1.id = c2.parent_id)
where
c2.parent_id is null;
However, the corresponding UPDATE
sets all the columns to TRUE
.
update catalog_category
set leaf_category = True
from
catalog_category c1
left outer join
catalog_category c2 on
(c1.id = c2.parent_id)
where
c2.parent_id is null;
Is an UPDATE
like that possible at all?