Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Decode Experts - Help
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‰
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed Nov 04 1998 - 21:01:56 CST