Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Help newbie with SQL code

Re: Help newbie with SQL code

From: Roman Miroshnichenko <miroshnichenko_at_cbsd.donetsk.ua>
Date: Fri, 16 Mar 2001 12:30:09 +0200
Message-ID: <98spu0$28tm$1@usb.dipt.donetsk.ua>

> What is wrong with this statement
>
> SELECT hiredate,
> DECODE (hiredate,(hiredate<01-jan-81),count(hiredate),hiredate)
> from emp;
>

The arguments of DECODE can't be logical

> output should look like this
>
> TOTAL 1980 1981 1982 1983
> -------- ----- ----- ------ -----
> 14 1 10 2 1
>

this output is complex to make,
best of all use like statment:

SELECT to_char(hiredate, 'YYYY'), count(*) FROM emp
GROUP BY to_char(hiredate, 'YYYY')
ORDER BY 1 Received on Fri Mar 16 2001 - 04:30:09 CST

Original text of this message

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