Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 20 Aug 2015 @ 10:08:50 GMT


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


Subj:   Re: Query to return records which are in sequence
 
From:   Tomas GORNER

Vipin,

Is this what you are looking for, or I am not even close?

     SEL
       col_hour
     ,col_value
     ,AVG (col_value) OVER ( PARTITION BY 1 ORDER BY col_hour
              RESET WHEN col_hour-1 > MAX(col_hour) OVER (PARTITION BY 1 ORDER BY col_hour
     ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) ROWS UNBOUNDED PRECEDING
     )
     FROM test
     ;

Regards,

Tomas



     
  <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: 23 Jun 2019