|
发表于 2024-11-7 10:32
来自手机
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
create temp table aa as
select *,substr(f01,1,length(f01)-1),(select x.f02 from
Sheet1 as x where substr(y.f01,1,length(y.f01)-1) like cast(x.f01 as text)) 父,f02 子 from Sheet1 as y;
//select * from aa;
with recursive under_alice(父,子,完整路径,级) as (select 父,子,子 完整路径,1 级 from aa where 父 is null union select x.父,x.子,under_alice.完整路径||'</td><td>'||x.子,级+1 from aa x join under_alice on x.父=under_alice.子 order by 1 desc)
select 完整路径 from under_alice x where not exists (select 父 from aa y where x.子 like y.父); |
|