Presto SQL 是否像 SQL Server 一样支持使用 CTE 的递归查询?例如员工层级 [英] Does Presto SQL support recursive query using CTE just like SQL Server? e.g. employee hierarchy level

查看:195
本文介绍了Presto SQL 是否像 SQL Server 一样支持使用 CTE 的递归查询?例如员工层级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Presto 中使用 CTE 编写递归查询来查找员工层次结构.Presto 支持递归查询吗?当我把简单的递归写成

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

<代码>与 cte as(选择 1 n联合所有从 cte 中选择 cte.n+1,其中 n<50)从 cte 中选择 *

它给出的错误是

推荐答案

当前答案

绝对的!自 Presto 340(现为 Trino)以来.

Absolutely! Since Presto 340 (now Trino).

旧答案

Presto 语法支持 WITH RECURSIVE name AS ...,但是递归 WITH 查询未实现.

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

这被作为功能请求进行跟踪:https://github.com/trinodb/trino/issues/1122

This is tracked as a feature request: https://github.com/trinodb/trino/issues/1122

这篇关于Presto SQL 是否像 SQL Server 一样支持使用 CTE 的递归查询?例如员工层级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆