select ColA from Table where colB=0 and ColA in (select /*+FIRST_ROWS*/ ColA from Table where ColB=1)

解决方案 »

  1.   

    select colA from table_name a 
    where colB = '1'
    and exists(select 1 from table_name where colA = a.colA and colB='0')
      

  2.   

    select cola from Table where colb in (0,1) group by cola having count(distinct colb) = 2
      

  3.   

    select colA from 
    (select colA, colB, decode(colB, 1, 1, 0, -1, -10000) colC from table_name) t
    group by colA
    having sum(colC)=0
      

  4.   

    select cola from table_name where colb = 1 
    intersect select cola from table_name where colb = 0;