Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 30 Sep 2002 @ 22:08:48 GMT


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


Subj:   Re: Data transposition
 
From:   Keith Turner

Try this:

SELECT NAME,
       ACCTNO,
       MAX ((CASE RNK WHEN 1 THEN PHONENO ELSE NULL END)) PHONE1,
       MAX ((CASE RNK WHEN 2 THEN PHONENO ELSE NULL END)) PHONE2,
       MAX ((CASE RNK WHEN 3 THEN PHONENO ELSE NULL END)) PHONE3
  FROM (SELECT NAME,
               ACCTNO,
               PHONENO,
               RANK (PHONENO) AS RNK
          FROM ACCTPHONE
         GROUP BY NAME, ACCTNO) AS PHONE_RANK
 GROUP BY NAME, ACCTNO


     
  <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