Re: Help for a student please

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Mon, 20 Mar 2000 00:52:10 +0100
Message-ID: <953509958.19083.5.pluto.d4ee154e_at_news.demon.nl>


replace count by
sum(decode(to_char(hiredate,'YYYY'),1980, 1, 0) "1980" and so on.

Hth,
Sybrand Bakker, Oracle DBA

Karen Standish <standish_at_kc.rr.com> wrote in message news:fWbB4.438$4V.42707_at_typhoon2.kc.rr.com...
> Good Evening and HELP PLEASE,
> I am stumped on one of my class questions. Currently taking a class for
SQL
> in oracle. The question is:
>
> create a query that will display the total number of employees and of that
> total the number who were hired in 1980, 1981, 1982, and 1983, label the
> columns appropriately.
>
> The query should look like this.
>
> Total 1980 1981 1982 1983
> _____ ____ ____ ____ ____
> 14 1 10 2 1
>
> I know this is not correct but I am just absolutely blocked.
>
> SELECT COUNT(*) AS TOTAL
> ,if
> ,count(TO_CHAR(HIREDATE,'YYYY')) "1980"
> ,count(TO_CHAR(HIREDATE,'YYYY')) "1981"
> ,count(TO_CHAR(HIREDATE,'YYYY')) "1982"
> ,count(TO_CHAR(HIREDATE,'YYYY')) "1987"
> FROM emp
> group by to_char(hiredate,'yyyy')
> /
>
>
> --
> Karen Standish
> standish_at_kc.rr.com
>
>
>
>
Received on Mon Mar 20 2000 - 00:52:10 CET

Original text of this message