Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 08 Sep 2003 @ 16:48:22 GMT


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


Subj:   Re: LEAD/LAG Analysis
 
From:   Watzke, Michael

No, the ordering in the analytical function's order by clause is NOT related to the output set ordering in the query statements order by clause.

If I understand you scenario the query would look like this

SELECT sales_man_id,monthn,totalsales
,MIN(totalsales) OVER (PARTITION BY sales_man_id ORDER BY monthn ROWS
BETWEEN 1 preceding AND 1 preceding) as LAG
FROM t
order by sales_man_id, monthn;

If I misunderstand the scenario it would be helpful if you had the syntax you wanted to use expressed using the lead/lag syntax.

Mike



     
  <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