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.
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.