Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 23 Aug 2004 @ 13:24:20 GMT


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


Subj:   Re: Alternative for Rank function
 
From:   Victor Sokovin

  I have found the alternative for the rank function.Just i would like to share the information.  


          SELECT A.salary_amount FROM employee  A    WHERE 10 = (SELECT DISTINCT
            COUNT(B.salary_amount) FROM employee B WHERE A.salary_amount <= B.salary_amount);
  this query gives me the desired result for finding the nth max value or min value in the table.the above query will give me the 10th max value in the table.  



I think that's what Dieter meant by joins with inequality conditions. Perhaps the query above works for the particular data you have in the table but it can give strange results when the context changes. Only for that reason I would stay clear of such joins. Dieter already mentioned performance problems they imply.


Regards,

Victor



     
  <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