mysql substract将列值进行倍增,并将结果放在空列中

时间:2017-12-14 21:32:21

标签: mysql

我是一个使用phpmyadmin的mysql新手。我想要的是以下内容:

  table  planning
  id int (11)
  actual_mileage int (11)
  base_filter_change int (11)
  last_filter_change int (11)
  next_filter_change int (11)

我需要的是自动获取

  substraction1 -> (actual_mileage int - last_filter_change int)= results  

然后

   substraction2 -> (base_filter_change - results)= endresults  

最后将结果抛到字段

    next-_filter_change

那就是all.thanks

1 个答案:

答案 0 :(得分:-1)

update planning
set next_filter_change = (base_filter_change - (actual_mileage - last_filter_change)