WITH RECURSIVE作为查询中的第二部分CTE。 Postgres的

问题描述 投票:1回答:1

我怎么能写这样的查询:

with t1 as 
(
select id 
from table1
),
RECURSIVE t2(
select * from t2
union
...
)

目前不允许这样做?

postgresql common-table-expression recursive-query
1个回答
0
投票

无论你在哪里放置递归CTE,recursive都需要在WITH之后:

with recursive t1 as 
(
  select id 
  from table1
), t2 (
  select *  
  from t2
  union
  ...
)
...
© www.soinside.com 2019 - 2024. All rights reserved.