我试图基于this
为分层组实现闭包表使用H2,以下似乎不可能:
delete link
from closure p, closure link, closure c
where p.parent = link.parent and c.child = link.child
and p.child=PARENT_ITEM and c.parent=CHILD_ITEM
这可以重写为在H2上工作,因为它看起来不像H2支持基于H2 grammar的DELETE语句中的表别名
答案 0 :(得分:1)
是的,一个完整的例子是:
create table closure(parent int, child int);
insert into closure values(1, 10), (10, 100);
delete from closure where exists(
select * from closure p, closure c
where p.parent = closure.parent
and c.child = closure.child
and p.child=10
and c.parent=1);