Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 25 Aug 2004 @ 03:19:52 GMT


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


Subj:   Re: Rank() and Partition By
 
From:   Fred Pluebell

Just QUALIFY on the same windowed RANK expression as in the SELECT list. You could repeat the actual expression if you want to, but the example below uses an alias:

     SELECT a.id, fullname, yearmonth, actualhrs,
     RANK() OVER (PARTITION BY yearmonth
     ORDER BY actualhrs DESC) AS Z
     FROM resource_time a join people_info b on a.id = b.id
     QUALIFY Z <= 10


     
  <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