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

Home -> Community -> Usenet -> c.d.o.server -> Re: Decode Experts - Help

Re: Decode Experts - Help

From: Matthias Gresz <GreMa_at_t-online.de>
Date: 5 Nov 1998 12:14:15 GMT
Message-ID: <71s4qn$n8e$1@news00.btx.dtag.de>


Hi,

try:

select

sum(decode(to_char( CELEBRATE, 'Q'), '1',1,0)) q1,
sum(decode(to_char( CELEBRATE, 'Q'), '2',1,0)) q2,
sum(decode(to_char( CELEBRATE, 'Q'), '3',1,0)) q3,
sum(decode(to_char( CELEBRATE, 'Q'), '4',1,0)) q4,
count(pk_field) total
from
HOLIDAY lakkundi_at_msn.com schrieb:
>
> A client wants us to list the number of occurrences of holidays
> celebrated by quarter from
>
> the holiday table. (Holiday table eg. below)
>
> HOLIDAY ACTUALDAT CELEBRATE
> ------------------------- --------- ---------
> NEW YEAR DAY 01-JAN-95 01-JAN-95
> MARTIN KING, JR. 15-JAN-95 16-JAN-95
> LINCOLNS BIRTHDAY 12-FEB-95 20-FEB-95
> VALENTINES DAY 14-FEB-95 14-FEB-95
> MEMORIAL DAY 30-MAY-95 29-MAY-95
>
> The output should have column headings that are Q1, Q2, Q3 etc. and look
> like the following:
>
> Title Q1 Q2 Q3 Q4 Total
> Holiday Occurrence 2 5 2 1 10
>
> Any tips greatly appreciated.
>
> I have tried but it does not well:
> sum(decode(to_char(CELEBRATEDDATE, 'Q'),1,NULL)) Q1,
> sum(decode(to_char(CELEBRATEDDATE, 'Q'),2,1,NULL)) Q2
>
> Thanks&#137;
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

--

Regards

Matthias Gresz :-)

Matthias.Gresz_at_Privat.Post.DE

Always log on the bright side of life.
http://www.stone-dead.asn.au/movies/life-of-brian/brian-31.htm Received on Thu Nov 05 1998 - 06:14:15 CST

Original text of this message

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