Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 19 Feb 2008 @ 21:54:15 GMT

  <Prev Next>  
Next> Last>>  

Subj:   Function for Pivoting Data
From:   Kamin Shah


Does Teradata have a function which I can use to Pivot data across - Convert multiple rows into multiple columns!!

Here is an Example:

If I have a table which has an Employee Id and a table which has the Employee Ids and date associated to an employee.

     ***Employee Table*

     Employee Id  Employee Name
     12345        Joe Smith
     45678        Sue Mary

     ***Employee Date Table*

     Employee                    Sequence
     Id         Date Role         Number     Date
     12345      Start Date                   02/01/2000
     12345      Promotion Date      1        03/01/2000
     12345      Promotion Date      2        04/01/2000

     ***Expected Output*
                                          1^st         2^nd
     Employee   Employee    Start        Promotion    Promotion
     Id         Name        Date         Date         Date
     12345      Joe Smith   02/01/2000   03/01/2000   04/01/2000


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