如何增加数量到数据库表字段? [英] How to add quantity to database table field?

查看:257
本文介绍了如何增加数量到数据库表字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:

文字框= 20
数量(存储在表RawMat中)= 40

新数量应为= 60

example:

textbox = 20
quantity (stored in table RawMat) = 40

new quantity should be = 60

推荐答案

尝试UPDATE语句:
Try an UPDATE statement:
UPDATE RawMat SET quantity = quantity + 20 WHERE Id=1


Try:
Try:
-- @addNewQuantity is the new value sent for update. 20 here. 
UPDATE 
  MtTable
SET
  Quantity = Quantity + @addNewQuantity


这篇关于如何增加数量到数据库表字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆