Hello,
I have SQL Server 2008 database with two tables. The first table is called Shelf. The second table is called Product. Each Product will belong to a Shelf. Based on this, I have a table structure that looks like:
**Product**
ID (int)
ShelfID (int)
Description (text)
**Shelf**
ID (int)
AisleNumber (int)
TotalProducts (int)
When a Product is inserted or removed, I need to update the "TotalProducts" value in the associated shelf. In an attempt to try this, I'm using a Trigger. However, I do not fully understand how triggers work. Can someone please show me how to accomplish this?
Thank you