“找table1表里面B字段非空的ID”不就是
select id from table1 where b is not null;

解决方案 »

  1.   

    我的意思是怎么把上面的connect by 语句中加入这个条件?
      

  2.   

    不太明白你的意思
    如果我想找table1表里面B字段非空的ID那么使用
    select distinct id from tables where b is not null应该是可以的
      

  3.   

    我的意思是
    怎么在connect by 语句里面加上筛选条件?
      

  4.   

    SELECT distinct ID FROM table1 START WITH ID 1 CONNECT BY ( PRIOR  ID = PARENT_ID
    AND b is not null )
      

  5.   

    谢谢 : Lastdrop(空杯) 
    非常感谢!!!
    周末休息了,今天才看到,不好意思
      

  6.   

    还有一个问题:这样的筛选条件不管是否满足,是不是都会返回那条id=1 的记录??
    而不管id=1的记录b是否为空
      

  7.   

    那你只要将START WITH的条件改为
    START WITH ( ID= 1  AND b is not null) CONNECT BY ... 就可以了!