求解。由于客观因素只能用sql实现,不然就递归了。。。多谢大家 select a.node_id,a.value from table1 a,table2 b where a.node_id=b.node_id start with b.status=1 connect by prior a.node_id=a.parent_id UP,这个需要用到 start...wiht connect by 语法,层次查询。
多谢回复!不过报 sql command not properly ended 错误,试了很多顺序还是不行,望解答,谢谢了 SQL code:
create table tb(id int,pid int); insert into tb select 1,0 from dual; insert into tb select 2,0 from dual; insert into tb select 3,1 from dual; insert into tb select 4,1 from dual; insert into tb select 5,3 from dual; create table tc(id int,statu