Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Using value from cloumns to generate a new value for new column

$
0
0
Hi I've data as below[quote]account period01 period02 period03 period04[/quote][quote]1111 null null null null[/quote][quote]1112 782 null null null[/quote][quote]1113 null null null 345[/quote][quote]1114 765 882 67 321[/quote]what i want to achieve is to get values from period1 till period04 and used the lasted value to code the value of accoutperiod,if value is from period1 then code it as 01, period2 as 02, period03 as 03 and period04 as 04. so the output should be like this[quote]account period01 period02 period03 period04 accoutPeriod[/quote][quote]1111 null null null null null[/quote][quote]1112 782 null null null 01[/quote][quote]1113 null null null 345 04[/quote][quote]1114 765 882 67 321 04[/quote]

Viewing all articles
Browse latest Browse all 3145

Trending Articles