hi
SQL> select a.a, a.b, b.c
2 FROM (select p a ,count(1) b FROM TEST1 GROUP BY P) a,
3 (select p1 c1,COUNT(1) c FROM TEST2 GROUP BY P1) b
4 where a.a =b.c1
5 /

A B C
---------- ---------- ----------
1 3 4

1 select a.a, a.b, b.c
2 FROM (select p a ,count(1) b FROM TEST1 GROUP BY P) a,
3 (select p1 c1,COUNT(1) c FROM TEST2 GROUP BY P1) b
4* where a.a !=b.c1
5 /

A B C
--------- ---------- ----------
2 2 4


if you see my join for != condition it returns 4 but the answer should be null. how to avoid the 4 there (and thru a single query)


Thanks in advance.