Re: Outer Join and Group By

From: Murthy Jarugumilli <murthy_at_tcs.com>
Date: 1995/08/05
Message-ID: <3vucr4$nik_at_tcsi.tcs.com>#1/1


>>I did a query like this:
 

>> select IN_NUMBER, IN_NAME, sum(OUT_AMOUNT)
>> from INNER, OUTER
>> where IN_NUMBER = OUT_NUMBER (+)
>> and OUT_MONTH >= '9504'
>> group by IN_NUMBER, IN_NAME;
 

>>I did not get the inner records that did not have any records in the outer
>>table. I got:
>
..

I think this is what you shoud do:

Select in_number, in_name, sum(out_amount) from inner, outer
where in_number = out_number(+)
AND OUT_NUMBER(+) >= '9504'
group by in_number, in_name

I think you need the (+) sign on all outer table columns for outer joins.

Murthy Jarugumilli.
TCSI, Berkeley
murthy_at_tcs.com Received on Sat Aug 05 1995 - 00:00:00 CEST

Original text of this message