Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 22 Aug 2008 @ 10:29:21 GMT


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


Subj:   Re: How Can I Avoid Repeating an Expression?
 
From:   Tienhoven, Menno van

Hi Phil,

Teradata allows you to reuse a 'calculated' column from a sub-select. So what you could do is to alter the From part of your query

     From
     (select
        (100 * (curr_bal - cl_amt) / cl_amt) as MyTempColumn,
         ..
     Rest_of_the_columns_needed
       ..
       From Table
     ) as MyTable

In your original query you can then use the MyTable.MyTempColumn in the CASE statement instead of having to restate the calculation every time.


Kind regards,

Menno van Tienhoven



     
  <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