【发布时间】:2017-11-13 17:05:38
【问题描述】:
我有一个带有 quantity 列的 product 表 和一个带有 productId 和 的 cart 表 PurchaseQuantity 列。 根据clientId从购物车表中选择所有productId和PurchaseQuantity的代码是什么(可以多于一个)。之后,特定产品数量根据购买的数量减少。 例如:
product table
productid Quantity
1 10
2 20
cart table
productId purchasedQuantity
1 5
2 3
now product table will be
productid Quantity
1 5
2 17
对此的 SQL 查询是什么?有什么解决办法??
【问题讨论】:
标签: mysql asp.net sql-server