Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: group by problem!!!

Re: group by problem!!!

From: Falko Rotter <fantomas99_at_gmx.de>
Date: Fri, 17 Aug 2001 13:12:53 +0200
Message-ID: <9liu6g$sfi$1@newsread2.nexgo.de>


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
GERMANY
Received on Fri Aug 17 2001 - 06:12:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US