Hi,
I am making it more complicated the following query is for 12months only , i
mean monthat is constant. what will be the remedy for (N)no of rows/ months
in the table where n can be 1 - 100.
Thanking You
Regards
Santonu Mukherjee.
----- Original Message -----
From: <[Email Address Removed] "LazyDBA.com Discussion" <[Email Address Removed] Wednesday, October 15, 2003 8:55 PM
Subject: Re: SQL problem
select
sum(decode(month,1, value, 0)) M_01,
sum(decode(month,2, value, 0)) M_02,
sum(decode(month,3, value, 0)) M_03,
sum(decode(month,4, value, 0)) M_04,
sum(decode(month,5, value, 0)) M_05,
sum(decode(month,6, value, 0)) M_06,
sum(decode(month,7, value, 0)) M_07,
sum(decode(month,8, value, 0)) M_08,
sum(decode(month,9, value, 0)) M_09,
sum(decode(month,10, value, 0)) M_10,
sum(decode(month,11, value, 0)) M_11,
sum(decode(month,12, value, 0)) M_12
from
month_v
;
> Hi All,
> I've encountered the following problem. Please advise
> me how to write the sql script.
>
>
> Table schema, "Month_V"
> (1) month number;
> (2) value number;
>
> The content of table.
> select * from Month_v;
>
> Month value
> ----- -----
> 01 100
> 02 200
> : :
> 11 100
> 12 200
>
> How to generate the following output in a single SQL
> statment?
>
> month 01 02 .. .. .. 11 12
> -----------------------------------------------
> value 100 200 .. .. .. 100 200
>
> Best Regards,
> Gordon
>
> -----------------------------------------------------------------
> 每天都 Yahoo!奇摩
> 海的顏色、風的氣息、愛你的溫度,盡在信紙底圖
> http://tw.promo.yahoo.com/mail_premium/stationery.html
>
> --------
> Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
> To unsubscribe: send a blank email to oracledba-[Email Address Removed] To subscribe: send a blank email to oracledba-[Email Address Removed] Visit the list archive: http://www.LAZYDBA.com/odbareadmail.pl
> Tell yer mates about http://www.farAwayJobs.com
> By using this list you agree to these
terms:http://www.lazydba.com/legal.html
>
--------
Oracle documentation is here:
http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Oracle LazyDBA home page