I have a Products table with columns:
ProductID INT PK
SoldCount INT
My other table, ItemsSold, contains items sold:
ProductID INT FK
Quantity INT
So this is a many to one relationship.
I want to update the Product.SoldCount field with the SUM of the rows in the ItemsSold table for each productID.
What would the sql look like?

1 answers
You can update the products table based on the items sold in your ItemsSold table like this:
The syntax is takes a while to get used to, but basically the subquery is the tricky part for most.
answered 2 years ago by:
246