Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Oracle Left Outer Join and totals
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