Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 22 Oct 2008 @ 17:02:05 GMT


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


Subj:   Re: First Row Function
 
From:   Kopuuravuri, Ramu

Use QUALIFY clause for first row in each ID.

     Sel id,amt from 
     QUALIFY RANK () OVER
     (
     PARTITION BY ID
     ORDER BY
     Amt ) = 1

Choose the best column for order by clause and the way you want to order like desc and asec order.

Best practice to choose the date column in history tables.


Regards,

Ramu.



     
  <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