Page 1 of 1
Need help to update the column value according other col
Posted: Wed May 04, 2011 1:51 am
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
Posted: Wed May 04, 2011 2:31 am
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
Posted: Wed May 04, 2011 2:46 am
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
Posted: Wed May 04, 2011 2:48 am
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
Posted: Wed May 04, 2011 3:51 am
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