Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 24 Jun 2005 @ 22:10:29 GMT


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


Subj:   Re: SQL to flattening a table
 
From:   Michael Larkins

I think I would do this using a self-join and since not all will have 4 accounts, an outer join:

     select a100.cust, a100.bal, a200l.bal, a300.bal, a400.bal
     from tb11 as a100 left join tb11 as a200 on a100.bal=a200.bal
                       left join tb11 as a300 on a100.bal=a300.bal
                       left join tb11 as a400 on a100.bal=a400.bal
     where a100.acct=100
       and a200.acct=200
       and a300.acct=300
       and a400.acct=400;

Hope this helps,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <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