Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 21 May 2004 @ 09:45:50 GMT


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


Subj:   Re: Select TOP 10 * ..
 
From:   McCall, Glenn D

Have you tried csum (or rank) and qualify

     select *
     from some_table
     qualify csum (1, sort_key_1, sort_key_2) <= 10;

csum might be better to use because it will generate unique numbers. Rank will return duplicate values if it encounters duplicate sort key values. For example

     SK1        SK2     rank          csum (1, sk1, sk2)
     1          1        1              1
     1          2        2 (or 3?)      2
     1          2        2 (or 2?)      3
     1          3        4              4

Hope this does it for you.

Glenn Mc



     
  <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