Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 18 Jul 2006 @ 09:44:36 GMT


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


Subj:   Re: How to get top N records
 
From:   Castelli Emanuel Alejandro

You can use QUALIFY ROW_NUMBER() function.

Following your example:

     SELECT FIELD1,
     FIELD2,
     SUM(FIELD3) as TOTAL
     FROM MYTABLE1
     WHERE
     
     Qualify row_number() over(order TOTAL ASC) <= N
     GROUP BY 1,2

I hope this help you.


Bye!

Castelli, Emanuel Alejandro
Desarrollo DataWarehouse - IBM Argentina



     
  <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