Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们可以在 Postgresql 中的一个查询中有两个 CTE 吗?
如果您的意思是在一个查询中而不是在一个表中,那么可以。例如:
WITH cte1 AS ( ... ), cte2 AS ( ... ) SELECT * FROM cte1, cte2
是的,我们可以。我们可以有嵌套的 CTE,例如:
WITH F AS (WITH D AS (.....) SELECT .... FROM (...) ;