Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 29 Nov 2010 @ 18:56:40 GMT


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


Subj:   Converting columns to rows in Teradata - UNPIVOT
 
From:   Prasad Kavil Kambrath

Hello experts,

To convert the columns to rows , I was trying UNPIVOT in Oracle 11g like given below

     KEY C1    C2    C3
     --- ----- ----- -----
     r1  v1    v2    v3
     r2  v1    v2
     r3  v1          v3
     r4  v1
     r5        v2    v3
     r6        v2
     r7              v3
     r8


     select key, source, val
     from
       t UNPIVOT INCLUDE NULLS
         ( VAL FOR( SOURCE ) IN
             ( C1 AS 'C1',
               C2 AS 'C2',
               C3 AS 'C3'
             )
         )
     order by key, source ;

Do we have any function in Teradata like UNPIVOT to achieve the same results ( without using union all)


Prasad K K



     
  <Prev Next>  
<<First
<Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023