Apache Doris 中文技术论坛
Questions Tags Users Badges

现在sql有没有方式实现自身父子关联?

Asked May 27, 2024 Modified May 28, 2024
Viewed 66
2.1 demand

类似于 oracle 的 level 关键字,一个表的数据有父id、子id,然后关联起来?

edited May 28, 2024
wunan12103
asked May 27, 2024
2 Answers

最好有sql demo,如果是那种递归CTE的话,目前Doris是不支持的

edited Jan 1, 1970
mink211
answered May 28, 2024
select
	a.*,
	level
from
	adam_departments a
start with
	a.p_dept_id = '0'
connect by
	prior a.dept_id = a.p_dept_id;

你好, 类似于这种的, 有方式实现吗? level是层级, p_dept_id和dept_id是父子关联关系

edited May 30, 2024
wunan12103
answered May 30, 2024
Related Questions
请教一下如果从commit成功的checkpoint恢复时任务时会发生啥
doris2 列查询性能问题
2 answers
时间分区字段str_to_date格式不正确后直接全表扫描导致CPU飙升
1 answers
查询doris外部表分区存在穿刺情况
Java 使用jdbc 驱动doris 数据库,进行批量压测插入操作,会显示有规律的突刺,怎么办,有3个FE 10个Be,各种参数调试已经调过了,还有没有其它方法处理
3 answers
2.1.9报错:Fail to do ZSTD compress due to exception std
1 answers

Terms of service Privacy policy

Powered by Answer - the open-source software that powers Q&A communities.
Made with love © 2025 Apache Doris 中文技术论坛.