Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 13 Jun 2002 @ 10:35:59 GMT


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


Subj:   Re: How to specify how many rows are to be returned by the SELECT statement
 
From:   Dieter N�th

  .SET RETLIMIT 1 - try this command if you are using BTEQ client to retrieve the first row , from the ordered output.  



But be aware, that by default still ALL rows are transferred and just discarded by BTEQ. You have to set RETCANCEL to avoid that.

You could also use following query from all clients:

SELECT JahrWoche , Lagerbestand
FROM NGT_Lagerbestand
WHERE ArtikelNr = '10011000' AND JahrWoche < 200217
AND Lagerbestand IS NOT NULL
QUALIFY RANK(JahrWoche) = 1

or in R4 SQL-99 compliant:

QUALIFY RANK() OVER (ORDER BY JahrWoche DESC) = 1

If Jahrwoche is not unique there may be more than one row in your result set. To avoid this, add more columns to the rank.


Dieter



     
  <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