Hi,
I need to create sequence number per ID.
For ex:
Input is ID column.
Output is ID and sequence number per ID.
ID Sequence_Number
100 1
100 2
101 1
102 1
102 2
102 3
102 4
103 1
If the Current records ID matches with the previous records ID, i need to increase the sequence number otherwise it should be one.
Is it possible to this in a single job itself?
Please guide me.
Thanks in Advance.
How to create sequence number per ID?
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 47
- Joined: Fri Sep 23, 2005 6:01 pm
This easy to do using 2 stage variables in a transform stage. Declare
StageSequence as IF In.ID=LastID THEN StageSequence+1 ELSE 1
LastID as In.ID
StageSequence as IF In.ID=LastID THEN StageSequence+1 ELSE 1
LastID as In.ID
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
All fine guys but the real question is do you need to preserve the sequences between job runs or is every run independant and can reinitialyze the sequences?
If not then the sugested logic works fine.
If not then the sugested logic works fine.
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org