Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 30 Sep 2002 @ 14:48:03 GMT


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


Subj:   Re: Data transposition
 
From:   Jon Downs

Hi Bruce,

........ it does rely on a phonetype and needs a extra join per column.

SELECT          T4.ACCOUNTNO AS ACCOUNT_NUMBER
               ,TRIM(T1.PHONE) AS PHONE1
               ,TRIM(T2.PHONE) AS PHONE2
               ,TRIM(T3.PHONE) AS PHONE3
FROM            VIEWDB.ACCOUNT   T4
LEFT OUTER JOIN VIEWDB.ACCPHONE  T1
ON              T4.ACCOUNTNO = T1.ACCNO
AND             T1.PHONETYPE = 1
LEFT OUTER JOIN VIEWDB.ACCPHONE  T2
ON              T4.ACCOUNTNO = T2.ACCNO
AND             T1.PHONETYPE = 2
LEFT OUTER JOIN VIEWDB.ACCPHONE  T3
ON              T4.ACCOUNTNO = T3.ACCNO
AND             T1.PHONETYPE = 3
;

hope it helps,

Jon Downs



     
  <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