SQL Server Update with Inner Join

前端 未结 3 975
离开以前
离开以前 2020-12-29 03:42

I have 3 tables (simplified):

 tblOrder(OrderId INT)  
  tblVariety(VarietyId INT,Stock INT)  
  tblOrderItem(OrderId,VarietyId,Quantity INT)
3条回答
  •  太阳男子
    2020-12-29 04:23

    You are doing an update. It will update once.

    Edit: to solve, you can add in a subquery that will group your orderitems by orderid and varietyid, with a sum on the amount.

提交回复
热议问题