【发布时间】:2012-02-04 17:01:39
【问题描述】:
我想用TRUE 更新列leaf_category,其中该类别不是父类别。它作为一个选择语句工作:
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;
但是,对应的UPDATE 将所有列设置为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;
这样的UPDATE 可能吗?
【问题讨论】:
标签: sql postgresql join sql-update