Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 13 Aug 2002 @ 09:10:09 GMT


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


Subj:   Re: Make DISTINCT records and generating sequence number
 
From:   Bach, Michael

Use CSUM to generate value for column_d as follows.

select
column_a,
column_b,
column_c,
csum(1,column_a) as column_d
from
your_table
group by 1,2,3
;

...where 1 is the running sum for each group and column_a is the sorting reference. Be sure that this column (or combination of columns) is your Primary Index (some may say Primary key) for the table as spool will be distributed on this choice. Poor selection will result in severe skewing.


Regards

Mike



     
  <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