Gid, mail_id, lastname, acct_id



G1,100,A,1

G2,100,A,2

G3,100,B,1

G4,100,X,5

G4,101,A,1

G5,101,B,1



Requirement : Group guests of same mail_id into one if lastname or acct_id is same.



1st record will be in default group 1

2nd record will be compared with the first -> goes to grp 1 ( last name is same)

3rd record will be compared with the first then second -> goes to grp1 ( acct_id is same)

4th record will be compared with first then second then third -> goes to grp 2 ( neither last name nor acct_id are same)



I need to do iteration in the above pattern in datastage.



Thanx and Regards
Pavan