SQL Server 2005中的计算 [英] calculation in SQL Server 2005

查看:60
本文介绍了SQL Server 2005中的计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有两个桌子
1.具有item_id,项目名称,费率,数量,总金额的库存
2.带有订单ID,商品名称,数量的订单

现在我正在为2件商品下订单,我们如何使用这两个表进行计算,例如从库存表中扣除总数量和数量.

假设2件商品的价格为每件10rs,则20rs为数量,因此从库存表中扣除的是总数量减去2件,再减去20rs.

我怎样才能做到这一点.

谢谢

Hi,

i have two table
1. inventory with item_id,Item Name,Rate,Quantity,Total Amount
2. Order with order id,item_name,quantity

now i am making order for 2 item how we calculate with these two table like deduct total amount and quantity from inventory table.

suppose 2 item rate is 10rs per item then 20rs is amount so deduct from inventory table is minus 2 item and minus 20rs from total amount.

how can i make it is possible.

thanks

推荐答案

我不太清楚你的问题.
据我了解,您需要使用SqlTransactions.
在订购商品后,只需更新该特定item_id的库存表即可.
将所有命令放在SqlTransaction下.
I am not too clear about your question.
As far as i understood, you need to use SqlTransactions.
After making orders for items, just update the inventory table for that particular item_id.
Put all Commands under a SqlTransaction.


这篇关于SQL Server 2005中的计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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