Home Page for the TeradataForum
 
 

 

Archives of the TeradataForum





Message Posted: Tue, 08 May 2001 @ 08:47:29 GMT





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




Subj:   Re: Restrict number of rows returned
 
From:   David Wellman



The SAMPLE (as Ulrich suggested) function will return the required number of rows, but you get no control over which 1000 rows you get (i.e. there's no order to it). This may or may not be what you want.

If you need the first 1000 rows, according to some sort-order, then you could use the CSUM function - add the following to the end of your query

Qualify CSUM(1,col1) <= 1000;

where 'col1' is one/more column(s) which determine how the rows are ordered before being numbered. This allows you to perform "top n" and "bottom n" queries.


Cheers,

Dave





     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
 
  Top Home Join Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky 
Last Modified: 30 Jun 2008