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)
 Complex Computation

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-25 : 08:44:16
Parimala writes "I have a meter table which has cols from P1 to P50 with MtrdID and Date being composite key. On inserting new rows and also upadting rows onto his table I have to sum up individual cols P1 through P50 and also aggregate all the 50 cols based on date.i.e
Aggregate= sum(p1)+....sum(p50) and update another table dealticket which has Total and P1 through P50 as columns.
In other words dealticket.P1 = Sum(P1) in metertable on a particluar date and so on till P50. Dealticket.Aggregate= Sum(p1) +...Sum(p50) from metertable based on particular date.

I want to know the optimal way of doing this in the update and Insert trigger.

thanks"
   

- Advertisement -