Hello sultan
You can create a view for the cc table and use with
the bb table to display the output .
create view cc_view as select id, sum(amount) amt
from cc group by id
select a.id,a.amount ,b.amount from bb a,cc_view b
where a.id=b.id;
Hope this solution work's for u.
I will also try without using view .
Regards
Sreeraman
----- Original Message -----
Sent: Monday, May 13, 2002 10:53 AM
Subject: SQL Help Urgent!!!!!!!!!
Hi gurus
I have two tables like this
SQL> select * from bb;
ID AMOUNT
DT ---------- ----------
------------------------------
1
1000
10-MAY-02
SQL> select * from cc;
ID AMOUNT ----------
-------------------
1
200
1
300
1 500
My query like this
=============
SQL> select
a.id,sum(a.amount),sum(b.amount) from bb a,cc b where
2 a.id=b.id 3 group by
4 a.id;
ID
SUM(A.AMOUNT)
SUM(B.AMOUNT) ----------
-------------
----------------------------------------
1
3000
1000
**** Based on the details table rows it sum up
three times the master amount ,that is why it shows 3000.
But my output should be like this
========================
ID
SUM(A.AMOUNT)
SUM(B.AMOUNT) ----------
-------------
----------------------------------------
1 1000
1000
Anybody can help me in this issue please.
Regards.
syed
|