Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 31 Oct 2003 @ 17:50:23 GMT


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


Subj:   Re: Is there any system column like the Oracle RowNum in Teradata?
 
From:   Jeremy Christiansen

Without knowing what your query looks like here a some examples.

1) Select a.rowid from table1 a;

Gives you the internal (and unique) rowid for table "A".

2) select csum(1,a couple of fields) from table1 a inner table2 b on a.a = b.a;

Gives a sequential # for every row in a result set. Csum works by ordering the result set according to an order list (denoted by "a couple of fields") and then computes a rolling sum according to the first argument (in this case the number "1"). The end result is that every row is assigned a unique number.

3) You can also use the sum window function instead of csum.

Good luck.



     
  <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