A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.
Moderators: chulett, rschirm, roy
-
Pacific007
- Participant
- Posts: 35
- Joined: Wed Oct 06, 2010 11:24 am
Post
by Pacific007 »
Exp.
Table name :School
col1 col2 col3
x a 1
y a 1
z a 1
x1 a 1
x2 a 2
x3 a 2
x4 a 2
x5 a 3
I need Output LIke this .Please help me.
col1 col2 col3
x a_1 1
y a_2 1
z a_3 1
x1 a_4 1
x2 a_1 2
x2 a_2 2
x3 a_3 2
x4 a_4 2
x5 a_1 3
Pacific
-
sonamasd@gmail.com
- Participant
- Posts: 6
- Joined: Sat Jan 09, 2010 1:37 am
- Location: india
Post
by sonamasd@gmail.com »
Take 3 variables
v1 = if col3=v2 then v3+1 else 1
v2 = col3
v3 = v1
and then in derivation of col2 give col2 : '_' : v1
I thnk it should work for ur requirement
ASHISH
Bangalore
-
zulfi123786
- Premium Member
![Premium Member Premium Member](./images/ranks/premium.gif)
- Posts: 730
- Joined: Tue Nov 04, 2008 10:14 am
- Location: Bangalore
Post
by zulfi123786 »
sonamasd@gmail.com wrote:Take 3 variables
v1 = if col3=v2 then v3+1 else 1
v2 = col3
v3 = v1
and then in derivation of col2 give col2 : '_' : v1
Unnecesay variale V3:
Reframe as:
v1 = if col3=v2 then v1+1 else 1
v2 = col3
- Zulfi
-
sonamasd@gmail.com
- Participant
- Posts: 6
- Joined: Sat Jan 09, 2010 1:37 am
- Location: india
Post
by sonamasd@gmail.com »
I think no need to take 3rd variable
below should work
v1 = if col3=v2 then v1+1 else 1
v2 = col3
and then in derivation of col2 give col2 : '_' : v1
ASHISH
Bangalore
-
Pacific007
- Participant
- Posts: 35
- Joined: Wed Oct 06, 2010 11:24 am
Post
by Pacific007 »
sonamasd@gmail.com wrote:Take 3 variables
v1 = if col3=v2 then v3+1 else 1
v2 = col3
v3 = v1
and then in derivation of col2 give col2 : '_' : v1
I thnk it should work for ur requirement
Thanks Dear..This is working fine
Pacific