oracle prior
--先上结论 prior id=fid时,下一行列fid的值起始行列id的值
--可以用树形结构来标识,当 prior父节点id=子节点fid时,父节点在最上
--当prior子节点fid=父节点id,父节点在最下
select id,fid from tab1 start with id=100078 connect by id=prior fid 1 100078 100971 2 100971 100735 3 100735 -1 select id,fid from tab1 start with id=100971 connect by prior fid=id 1 100971 100735 2 100735 -1 select id,fid from tab1 start with id=100971 connect by prior id=fid 1 100971 100735 2 196 100971 3 197 196 4 220 196