Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 17 Jul 2006 @ 19:19:13 GMT


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


Subj:   How to get top N records
 
From:   Bhakti Ulhas Bongale

Hi,

Is there any function, other than ranking, by which I can select the top N records of a result set?

For e.g, if I have the following query:

     SELECT FIELD1,
     FIELD2,
     SUM(FIELD3)
     FROM MYTABLE1
     WHERE
     
     GROUP BY 1,2
     ORDER BY 1,2 ASC,3 DESC

This query returns me say 2000 rows. I want only the top 50 rows. Is there any function similar to ROWNUM in Oracle that will give me the expected result?


Regards,

Bhakti



     
  <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: 27 Dec 2016