Thanks JModic!!
But I'd tried this. I think there was some typing mistakes but the results are not comming correct.
See for your self.
SELECT PK_ID1 FROM Table1 ORDER BY PK_ID1;
PK_ID1
--------------
1000000001
1000000002
1000000003
1000000004
1000000005
1000000006
1000000007
1000000008
1000000009
SELECT PK_ID2, PK_ID1 FROM Table2 ORDER BY PK_ID1, PK_ID2;
PK_ID2 PK_ID1
-------------- ----------
1000000004 1000000001
1000000010 1000000001
1000000002 1000000002
1000000003 1000000002
1000000008 1000000002
1000000009 1000000002
1000000006 1000000003
1000000007 1000000004
1000000011 1000000005
1000000012 1000000005
1000000013 1000000006
1000000014 1000000006
1000000015 1000000007
1000000016 1000000007
1000000017 1000000008
1000000018 1000000008
1000000019 1000000009
SELECT PK_ID3, PK_ID1 FROM Table3 ORDER BY PK_ID1, PK_ID3;
PK_ID3 PK_ID1
-------------- ----------
1000000004 1000000001
1000000003 1000000002
1000000005 1000000005
1000000009 1000000005
1000000006 1000000006
1000000007 1000000007
1000000008 1000000008
The Query we discussed Gives something wrong:
Select
count(a.pk_id3) cnt_table3,
count(b.pk_id2) cnt_table2,
c.pk_id1
from table3 a, table2 b, table1 c
Where c.pk_id1 = b.pk_id1
and c.pk_id1 = a.pk_id1
Group by c.pk_id1
CNT_TABLE3 CNT_TABLE2 PK_ID1
--------------- --------------- --------------
2 2 1000000001
4 4 1000000002
4 4 1000000005
2 2 1000000006
2 2 1000000007
2 2 1000000008
While if we run individual counts on the two table
we get the following:
Select
count(PK_ID2) cnt_table2, PK_ID1
from table2
Group by PK_ID1
CNT_TABLE2 BRD_ID
--------------- --------------
2 1000000001
4 1000000002
1 1000000003
1 1000000004
2 1000000005
2 1000000006
2 1000000007
2 1000000008
1 1000000009
Select
count(PK_ID3) cnt_table3, PK_ID1
from table3
Group by PK_ID1
CNT_TABLE3 BRD_ID
--------------- --------------
1 1000000001
1 1000000002
2 1000000005
1 1000000006
1 1000000007
1 1000000008
Thanks for the support.. But I think there is something more to be done.
Regards
Shruti