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

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle Left Outer Join and totals

Re: Oracle Left Outer Join and totals

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Mon, 22 May 2006 20:52:35 +0200
Message-ID: <44720875$0$14422$626a54ce@news.free.fr>

<bbcrock_at_gmail.com> a écrit dans le message de news: 1148323051.803427.320640_at_j55g2000cwa.googlegroups.com...
|I want to get the following result, but can't seem to do it in one
| query. should be very simple, but I can't wrap my head around it. I
| have 4 teams and want to select the count on the number of reports per
| team. Most commonly this number will be zero. Report should look
| like:
|
| Team A (3)
| Team B (2)
| Team C (0)
| Team D (0)
|
| I did a left outer join on team and count(reports) and of course got:
|
| Team A (3)
| Team B (2)
| Team C (1)
| Team D (1)
|
| because there was a single null row for every left item in the Left
| Outer Join.
|
| I presume I need to do a subselect, but I can't make it work. Feel
| free to point me to Ask Tom, I'm using the wrong syntax to search for
| this solution- drawing a total blank here!
|
| thanks for any help!
|
| Don
|

Feel free to post your Oracle version, ddl and query you tested.

Regards
Michel Cadot Received on Mon May 22 2006 - 13:52:35 CDT

Original text of this message

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