|
|
Archives of the TeradataForum
Message Posted: Tue, 13 Aug 2002 @ 09:10:09 GMT
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
| |