Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulate each record

Status
Not open for further replies.

nkiefer

Programmer
Joined
May 21, 2001
Messages
86
Location
US
I am using SQL server 2000 and have the following;

I have a table (tblData) that is the many side in a one-to-many relationship. The table contains data from a lab instrument. I would like to have a trigger fire when new data is added to the table tblData. When the trigger fires I need to smooth out the data and append the smoothed data to a new table called tblSmooth.

For example; There are 160 readings collected in tblData. I want to average readings 1,2,3,4,5 and take that average and make it point 1 in the table tblsmooth. Then average points 2,3,4,5,6 and take that average and make it point 2 in the table tblSmooth and so on ...

To add more complexity, if any of the data points used in the averaging is some percentage less than the point before it use the point before it in the average. For example if averaging points 1,2,3,4 and 5; if 2 is 25% < the value of point 1 use point 1 value in the average not 2. So the average would be avg (1+1+3+4+5)/5.

any help is appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top