select * from table where id in (select pid from table where id=50)不知是不是楼主要的

解决方案 »

  1.   

    SQL> select * from t;        ID        PID
    ---------- ----------
            20         10
            30         20
            40         30
            50         40已用时间:  00: 00: 00.20SQL> select * from t start with id=50 connect by prior pid=id;        ID        PID
    ---------- ----------
            50         40
            40         30
            30         20
            20         10已用时间:  00: 00: 00.20
    SQL>
      

  2.   

    select id from
    select t.*,level from t start with id=50 connect by prior pid=id
    )
    where level > 1