Re: Is this query possible?
Date: 1996/07/12
Message-ID: <31e645d4.153405_at_n5.gbso.net>#1/1
mskc_at_io.com (Casey Claiborne) wrote:
>
>Hello,
> I have rows that are similar to the following:
>
>
>YearNo WeekNo DayNo ID Total
>------ ------ ----- --- -----
>1996 1 1 7 $35.00
>1996 1 2 7 $65.00
>1996 1 3 7 $25.00
>1996 1 4 7 $12.00
>1996 1 1 10 $35.00
>1996 1 2 10 $65.00
>1996 1 3 10 $25.00
>1996 1 4 10 $12.00
>1996 1 1 12 $35.00
>1996 1 2 12 $65.00
>1996 1 3 12 $25.00
>1996 1 4 12 $12.00
>
>I need to get a result of something like ...
>
>WeekNo ID Mon Tue Wed Thur Fri.
>1 7 $35 $65 $25 $12 0
>1 10 $35 $65 $25 $12 0
>1 12 $35 $65 $25 $12 0
>
>How can I do this? Any help hints or advice would be *greatly*
>appreciated :) Sorry about the length of this post, I just
>wanted to be clear -
>
>TIA
>
>
select
weekno, sum(decode(dayno,1,total,0)) Monday, sum(decode(dayno,2,total,0)) Tuesday, sum(decode(dayno,3,total,0)) Wednesday, sum(decode(dayno,4,total,0)) Thursday, sum(decode(dayno,5,total,0)) Friday, from mytable group by weekno;
-- Chuck Hamilton chuckh_at_dvol.com Never share a foxhole with anyone braver than yourself!Received on Fri Jul 12 1996 - 00:00:00 CEST