how to combine recursive CTE and normal CTE

后端 未结 1 661
生来不讨喜
生来不讨喜 2021-01-19 16:11

I want a first a normal CTE on table and followed by a recursive CTE

how can I combine this two?

I know for multiple pure normal CTE I can do



        
1条回答
  •  有刺的猬
    2021-01-19 17:13

    Just put the recursive at the start, even if the recursive one comes later:

    with recursive cte1 as (
     ...
    ), cte2 as (
      -- here comes the recursive cte
      ...
    )
    select *
    from ...
    

    0 讨论(0)
提交回复
热议问题