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

Reply via email to