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: 2 count in a same select

Re: 2 count in a same select

From: Horson <horson_at_poczta.fm>
Date: Tue, 30 Apr 2002 10:28:23 +0200
Message-ID: <3cce55d0$1_3@news.vogel.pl>


Try this one:
select category, nvl(sum(cnt_do), 0) cnt_events, decode(sum(cnt_do), null, 0, count(0)) cnt_distinct_objects
from objects o,

        (select code, object, count(0) cnt_do from events group by code, object) e
where o.code = e.code(+)
group by category

Uzytkownik "gil guerillot" <gil.guerillot_at_ratp.fr> napisal w wiadomosci news:aajeof$9ch$1_at_gotix.reseau.ratp...
> i have 2 tables objects and events:
>
> objects: code,category
> events: object,code,date
>
> join by events.object=object.code
>
> i want to count by category the number of events and the number of
distinct
> objects with the same SQL SELECT query
>
> how can i do?
>
>
>
>
Received on Tue Apr 30 2002 - 03:28:23 CDT

Original text of this message

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