Home Page for the TeradataForum
 
 

 

Archives of the TeradataForum





Message Posted: Mon, 10 Jul 2006 @ 12:34:41 GMT





     
  <Prev Next>   <<First <Prev Next> Last>>  




Subj:   Re: Converting Rows to coulmns by some Fucnction of teradata
 
From:   Butt, Muhammad Affan



Hi,

There is no direct funtion for doing this, yes you can do that but the problem is that in your 2nd column you should exactly know the values you want to move into column or one option would be write an SP for generating the dynamic query for N number of values.

see a crude example as direction to how to do it.

     SELECT ID,
                  MAX(CASE Tp_code WHEN 'MBLOTM'   THEN Tp_code ELSE '' END) AS Col1,
                  MAX(CASE Tp_code WHEN 'MBLACF'    THEN Tp_code ELSE '' END) AS Col2,
                  MAX(CASE Tp_codeWHEN 'MBLPCP'    THEN Tp_code ELSE '' END) AS Col3,
                  MAX(CASE Tp_codeWHEN 'MBLSMS' THEN Tp_code  ELSE '' END) AS Col4
          FROM 
          GROUP BY 1

HTH


Kind Regards,

Muhammad Affan





     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
 
  Top Home Join Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky 
Last Modified: 30 Jun 2008