Hi All - 

I have a query which returns result set as follows:

year amt_type amount 

2001 vacation 1000
2001 medical  1000
2001 college 15000
2002 vacation 800
2002 medical  1000
2002 college 10000
2003 vacation 400
2003 medical  2000
2003 college 80000.

I am trying to make the years 2001, 2002, and 2003 as columns and trying to 
achieve the below output

Amt type        2001       2002   2003
vacation        1000       800    400
medical         1000       1000   2000
college         15000      10000  8000

I am able to achieve this perfectly on client side. Right now I am trying to 
achieve the same through using SQL. I am using

DECODE to achieve but my result set looks like below    

Amt type        2001       2002   2003
vacation        1000              
vacation                   800
vacation                          400
medical         1000
medical                    1000   
medical                           2000
college         15000      
college                    10000  
college                           8000


I am trying this on oracle. I am new to this concept. can anyone who worked in 
similar situation help me. Also, the years may change depending upon the 
dropdown selection on client page. Can I transpose rows to columns in SQL for 
dynamic values

Thanks 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334354
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to