Hi,
There are two tables.
SQL> desc test
Name Null? Type
X NUMBER
Y NUMBER

SQL> desc test1
Name Null? Type

P NUMBER

SQL> select p a ,count(1) b FROM TEST1 GROUP BY P
2 /

A B
---------- ----------
1 3
2 2

SQL> select p1,COUNT(1) c FROM TEST2 GROUP BY P1
2 /

P1 C
---------- ----------
1 4


I have written a query (given below)
select a.a, a.b, b.c
FROM (select p a ,count(1) b FROM TEST1 GROUP BY P) a,
(select p1,COUNT(1) c FROM TEST2 GROUP BY P1) b

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

but for the second row (2 2 4 ) the c value should be null.
My requirement is for the matching records in both the queries the answer should come for C else it should return null.

Thanks in Advance