I have a table Items, which has fields Inventory and ItemId (the primary key).
And I have another table Allocations, which has fields Allocation and ItemId, which is a foreign key referencing Items.ItemId.
Thus many Allocations can relate to one Item.
I wonder how I can add a constraint to not allow SUM(Allocation) in the Allocations table for the same ItemId to accede Items.Inventory for that ItemId. I could find only very simple examples, so I am not sure how to approach this problem.