Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 24 Jun 2005 @ 20:41:37 GMT


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


Subj:   Re: SQL to flattening a table
 
From:   Anomy Anom

<-- Anonymously Posted: Friday, June 24, 2005 16:18 -->

Maybe something like this would work for you.

     select a . cust , a . acct , a . bal , b . acct , b . bal , c . acct , c
     .
     bal , d . acct , d . bal
     from (select cust , acct , bal  from tbl1 where acct = 100 ) a
     left join ( select cust , acct , bal from tbl1 where acct = 200 )  b
     on a . cust = b . cust
     left join ( select cust , acct , bal from tbl1 where acct = 300 ) c
     on a . cust = c . cust
     left join ( select cust , acct , bal from tbl1 where acct = 400 ) d
     on a . cust = d . cust

Regards



     
  <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