Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 03 Jun 2009 @ 10:08:00 GMT


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


Subj:   Re: LAST row in an aggregate group
 
From:   Singh, Lakhwant

Chaim,

You can use RANK function.

     Select NAME, DEPARTMENT
      from   TEST
     Qualify RANK() OVER (Partition By DEPT Order by NAME desc) = 1

(You can sort with some other key instead of NAME e.g. EMPLOYEE_ID etc which would be a better idea)


Hope this helps!

Lakhwant Singh
Certified SQL Specialist



     
  <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