Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 21 Mar 2006 @ 19:23:48 GMT


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


Subj:   Re: Use of Ordered Analytical Functions
 
From:   Dieter Noeth

Anomy.Anom wrote:

  Compare the current account record with the previous account record , i.e. where the values of current col1 = previous col1 and current col2 = previous col2 and current col3 - 1 = previous col4 then output the following calculated value for col15 (smallint)  


A "previous" value is calculated by

     min(colA) over (partition by colB, colC order by colD
                      rows betwen 1 preceding and 1 preceding)

This is mainly usefull if the "previous" row is not easily calculated (i.e. not "col - 1").

But if you can write the query with a simple join this will probably perform better.


Dieter



     
  <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