|
|
Archives of the TeradataForum
Message Posted: Mon, 09 Oct 2000 @ 16:52:44 GMT
Subj: | | Re: V2R3 SQL Documentation - Rank Function |
|
From: | | David Wellman |
Jim,
Many people have used RANK as a means of generating sequential numbers for rows in an answer set. It's fine if you can uniquely identify
each row (and to be honest most of the time you can). But on the off-chance that you can't, try using the following sql that I came across
whilst teaching a course recently;
SELECT col-1,col-2,..., CSUM(1,1)
FROM table
....
This will generate sequential id's for each row in the answer set, regardless of duplicate data values.
Regards,
Dave
| |