Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: simple query help
Gabriel Millerd <millerd_at_ns1.rli-net.net> wrote in message
news:84do8m$blc$1_at_news.powerisp.com...
>
> i have a table as follows (#1). i would like to have a report
> that gave the following (#2). can anyone help me?
>
> (#1)
>
> dept dude status
> ==== ==== ======
> north, bob, i,
> north, jim, a,
> north, sam, i,
> north, jeff, a,
> north, mary, a,
> north, sal, a,
> east, mary, a,
> east, dwaine, i,
> east, tom, i,
> east, bill, i,
> east, chuck, a,
> south, matt, a,
> south, holly, a,
> west, joy, i,
> west, stacy, a,
>
> (#2)
>
> dept active inactive
> ==== ====== ========
> north 4 2
> east 2 3
> south 2 0
> west 1 1
select dept, count(decode(status, 'a', 1)) as active,
count(decode(status, 'i', 1)) as inactive
from dept
group by dept;
Received on Thu Dec 30 1999 - 20:30:04 CST
![]() |
![]() |