Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 21 May 2004 @ 08:42:21 GMT


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


Subj:   Select TOP 10 * ..
 
From:   Sonny Chee

Hey Guys,

Anyone know of a way to get Teradata to just return just the first X number of rows? I know queryman will ask you after retrieving 2000 rows if you want to continue and get the rest but I'm looking for a way to specify the number of rows I want in the SQL. In MS SQL Server for example one types,

     Select top 10 * from myTable

to retrieve the first 10 rows from myTable.

Just to clarify my question, I know I can use the sample clause to return a random sample of X rows. What I really want is the first X in a sorted list. So my earlier sample query should have really been:

     Select top 10 *
     From MyTable
     Order by MyTable.Col1

Using the Sample together with Order By clause just seems to give a random sampling of records....


Sonny.



     
  <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