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 -> Oracle Left Outer Join and totals

Oracle Left Outer Join and totals

From: <bbcrock_at_gmail.com>
Date: 22 May 2006 11:37:32 -0700
Message-ID: <1148323051.803427.320640@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 Received on Mon May 22 2006 - 13:37:32 CDT

Original text of this message

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