Archives of the TeradataForum
Message Posted: Tue, 08 May 2001 @ 08:47:29 GMT
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.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|