数据库表task里面有id 和parentid,还有层级,当parentid不为空的时候,说明有子项。如何循环取出子项。下面我想用with as 这个写法循环查出。报错。https://wenku.baidu.com/view/7bd87bc9e309581b6bd97f19227916888486b992.html这个直接拿过来改变一下表名和字段也是宝这样的错误with py_sd as (select id,parentid , level_n from A where level_n ='1'union all select prj.id,prj.parentid , level_n+1 from py_sd c inner join A prj on c.id = prj.parentid )insert overwrite table oa.withtestselect id,parentid , level_n from py_sd tf