select *, salary + salary * case when append is not null then append else 0 end as total from t1 ;