i have 4 column, Sup1,Sup2,Sup3 and Vers.
i have to update Vers values from sup1, if sup1 null get values from sup2, if sup 2 null get values from sup3. if Sup1,Sup2,Sup3 are null then NULL.
look like this :
sup1 sup2 sup3 vers
1 1
2 2
3 3
4 4 5 5
0 0 0 NULL
i have tried this
update CRATEST set
--more next ( 4 to n ) columns here if required
Vers = (case when (Sup1 is null) then Sup2
when (Sup2 is null) then sup3
when (sup3 is null) then Sup1 else 'NULL' end);