我想更新n个行项值。 [英] I want to update n number of row item value.
本文介绍了我想更新n个行项值。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两张桌子像
表1 - 工作单
SI NO - 产品 - 数量
1显示器10
2鼠标20
3键盘15
4扬声器10
表2 - 比尔
SI NO - 产品 - 产品编号 - 数量
1监视器1 5
2鼠标2 8
3扬声器4 7
当我点击更新按钮时,我想显示表格 - 工作单如
SI NO - 产品 - 数量
1显示器5
2鼠标12
3键盘15
4扬声器3
解决方案
您好,
试试这个...
更新 work_order a
set
a.Qty = a.Qty - b.Qty
来自
Bill b
其中
a.SI_NO = b。 Product_Id
- 和a.Product = b.Product
希望这会对你有所帮助。
干杯
I have 2 tables like
Table 1 - Work Order
SI NO - Product - Qty
1 Monitor 10
2 Mouse 20
3 Keyboard 15
4 Speaker 10
Table 2 - Bill
SI NO - Product - Product Id - Qty
1 Monitor 1 5
2 Mouse 2 8
3 Speaker 4 7
When i click update button i want to show Table - work order like
SI NO - Product - Qty
1 Monitor 5
2 Mouse 12
3 Keyboard 15
4 Speaker 3
解决方案
Hi,
Try this...
update work_order a set a.Qty=a.Qty - b.Qty from Bill b where a.SI_NO=b.Product_Id --AND a.Product=b.Product
Hope this will help you.
Cheers
这篇关于我想更新n个行项值。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文