Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: group by problem!!!
Hi,
>
> select A.sector, A.cnt closed, B.cnt all_events
> from
> ( select sector, count(event) cnt from T where status='C' group by sector)
> A,
> ( select sector, count(event) cnt from T group by sector) B
> where A.sector=B.sector;
>
> Ales
>
i'm to fast, my statement was wrong!
But yours is only nearly correctly. If is in a group of
a sector no row with status C, then the sector is not
in the result set. I you want to have all sectors in the
result you must use an outer join.
-- Best regards, Falko Rotter _________________________________________ - Software Developer - Rotter & Kalweit Softwaredesign GbR Friemarer Straße 38 99867 Gotha GERMANYReceived on Fri Aug 17 2001 - 06:12:53 CDT