Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: simple query help
Doug O'Leary <dkoleary_at_mediaone.net> wrote in message
[snip]
> I tried a couple of things with decode and nvl; however, I'm still not
> getting anywhere with it. I can't seem to get around the fact that the
> query for south/inactive returns no rows, hence, the entire south dept is
> skipped.
Why didn't you get it?
Look at the script, it works:
SQL> select dept, count(decode(status, 'a', 1)) as active,
2 count(decode(status, 'i', 1)) as inactive
3 from test
4 group by dept;
DEPT ACTIVE INACTIVE
-------- --------- ---------
east 2 3 north 4 2 south 2 0 west 1 1
> I've heard of the concept of an outer join - don't know how to do one
> yet, but I've heard of it. Is that what's required here?
It can be done using a FULL JOIN, but not supported by Oracle. Received on Wed Jan 05 2000 - 09:14:40 CST