Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Help newbie with SQL code
Here is the DECODING
select count(*) total,
sum(decode(to_char(hiredate, 'YYYY'), 1980,1,0))"1980", sum(decode(to_char(hiredate, 'YYYY'), 1981,1,0))"1981", sum(decode(to_char(hiredate, 'YYYY'), 1982,1,0))"1982", sum(decode(to_char(hiredate, 'YYYY'), 1983,1,0))"1983"from emp;
1 <1_at_1.com> wrote in message news:tb2n2ilp13ab22_at_corp.supernews.com...
> What is wrong with this statement
>
> SELECT hiredate,
> DECODE (hiredate,(hiredate<01-jan-81),count(hiredate),hiredate)
> from emp;
>
> Help. the question was to use the Oracle training database table emp and
> count the emplyees that were hired by hiredate.
> output should look like this
>
> TOTAL 1980 1981 1982 1983
> -------- ----- ----- ------ -----
> 14 1 10 2 1
>
>
> I know you need DECODE but I just dont know if you can inbed things
>
> Thanks
> Andy
>
>
Received on Fri May 18 2001 - 00:42:00 CDT