id val type1 b_v_type 1 10 1 1 2 5 2 2 3 25 1 1 4 40 1 2
val base_value1 base_value2 10 110 null 5 null 195 25 135 null 40 null 235
update t set @base_value1=base_value1=@base_value1+ case when type1=1 then val when type1=2 then val*-1 end when b_v_type=1
update t set @base_value2=base_value2=@base_value2+ case when type1=1 then val when type1=2 then val*-1 end when b_v_type=2
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)