Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Sum, Update Trigger

Author  Topic 

Scott
Posting Yak Master

145 Posts

Posted - 2000-11-18 : 08:06:55
I need a trigger that will do the following:

Table1 has ID & Amount
Table2 has ID & TotalAmount

I need a trigger that will add all the amounts per ID in table1 and update the totalamount in table2 for each of the ID's in table1. (TotalAmount in table2 is of type money)

eg: ID Amount

12 $123.34
11 $34.90
12 $21.89
11 $34.56
13 $12.98

Must update table2 with the following:

ID TotalAmount

11 $69.46
12 $145.23
13 $12.98

   

- Advertisement -