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以上
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);
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
楼主????
FROM TABLE A,TABLE B
WHERE A.a1=B.a1 and A.a2=B.a2 and A.a4<>B.a4以上
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);
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