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
 General SQL Server Forums
 New to SQL Server Programming
 Aggregate Table

Author  Topic 

howesy
Starting Member

1 Post

Posted - 2009-06-29 : 18:27:44
I have question regarding aggregate tables and how to perform an update. I'll do my best to include all relevant info.

I have a project that counts multiple objects passing through devices and records the counts in a table called flow with the columns timestamp and num_objects.

There is another table that is called entrance that I want to use to record aggregates of flow information in hourly chunks. It has the columns starttimestamp, endtimestamp and total_num_objects.

An entrance is contributed to by multiple devices and a device can contribute to multiple entrances. Thus there is a device / entrance lookup table.

I had intended to use a trigger to update the aggregate table so when a new flow item is recorded it is aggregated onto the entrance total for the entrance(s) that that particular device contributes to.

My questions are:-

Is a trigger the best way to do this?

How can I update the multiple entrance that the device contributes to?

Many Thanks for your help in advance..



visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-30 : 13:11:29
sorry your explanation is not fully clear. perhaps you can elaborate your scenario with some data in below format

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -