Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 17 Jul 2006 @ 21:09:30 GMT


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


Subj:   Re: How to get top N records
 
From:   Mohommod.Khan

If you are in V2R6, you can try some thing like this:

     SELECT TOP 5
     field1, field2
     FROM table
     ORDER BY 2 DESC;

Which is same as:

     SELECT field1, field2
     FROM table  QUALIFY ROW_NUMBER () OVER (ORDER BY field DESC) <= 5;

Thanks



     
  <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