where a1=a2 and a1<>a4

解决方案 »

  1.   

    楼主的意思应该是a1=a2的记录集中,且a4互不相等的记录集
    楼主????
      

  2.   

    SELECT A.a1,A.a2,A.a3,A.a4
    FROM TABLE A,TABLE B
    WHERE A.a1=B.a1 and A.a2=B.a2 and A.a4<>B.a4以上
      

  3.   

    select * from table a where a.a1 = a.a2
    minus
    select * from table b where b.a1 = b.a2 and
           b.a4 in (select c.a4 from table c group by c.a4 having count(c.a4) >1);
      

  4.   

    1  select a,b,c,d from (
      2  select a,b,c,d,decode(a,b,decode(a,d,1,0),0) f from test)
      3* where f=1
    SQL> /         A          B          C          D
    ---------- ---------- ---------- ----------
             1          1          4          1SQL> select * from test;         A          B          C          D
    ---------- ---------- ---------- ----------
             1          1          3          2
             1          1          4          1
             1          2          4          1