Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 21 Mar 2006 @ 19:52:29 GMT


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


Subj:   Re: Use of Ordered Analytical Functions
 
From:   Christian Schiefer, makeITdone

Hi,

you need some sort criteria. Say it would be "start_date"

Try:

     Select ( case when col5 = prev_col5 then 1 else 0 end ) +
     ( case when col6 = prev_col6 then 1 else 0 end )

     >From
(
     Select col5
     , max( col5 ) over ( order by start_date rows between 1 preceding and 1
     preceding ) as prev_col5
     , col6
     , max( col6 ) over ( order by start_date rows between 1 preceding and 1
     preceding ) as prev_col5

     >From table
     ) t01;

Hope this helps,

Christian Schiefer

makeITdone IT Services
Vienna Austria



     
  <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