Does Presto SQL support recursive query using CTE just like SQL Server? e.g. employee hierarchy level

让人想犯罪 __ 提交于 2020-07-09 05:10:53

问题


I want to write a recursive query using CTE in Presto to find Employee Hierarchy. Do Presto support recursive query? When I write simple recursion as

with cte as(select 1 n union all select cte.n+1 from cte where n<50) select * from cte

It gives error that

Error running query: line 3:32: Table cte does not exist

回答1:


Presto grammar supports WITH RECURSIVE name AS ..., but recursive WITH queries are not implemented.

This is tracked as a feature request: https://github.com/prestosql/presto/issues/1122



来源:https://stackoverflow.com/questions/55428322/does-presto-sql-support-recursive-query-using-cte-just-like-sql-server-e-g-emp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!