Can someone give me some pointers on how to approach this in SQL (MS SQL 2008) ....
Table-1 has a Status, a Value and an ID
Table-2 is linked to Table-1.ID via Table-2.Table1ID (many Table-2 rows to one Table-1 row)
Table-3 is linked to Table-2 .ID via Table-3.Table2ID and has a Value (many Table-3 rows to one Table-2 row)
What I need to do is create a query that can run against Table-1 and check the total of the linked Table-3 values. If the sum of Table-3.Value equals the Table-1.Value, I need to set Table-1.Status to Closed. If not, I need to set Table-1.Status to Open
Hope this makes sense.
Can anyone get me started?