I am trying to do some calculations based on record from master table and wanted store manipulated result into a separate test table.
>Table:Master:
>C1 C2 C3 C4
>---------- -------- -- --
>2011-02-19 Test-A 31 3
>2011-02-19 Test-B 34 3
>2011-02-19 Test-C 17 1
>2011-02-15 Test-A* 48 =I 4
>2011-02-15 Test-B 64 6
>2011-02-15 Test-C 55 5
>2011-02-11 Test-A 64 =I2 6
>2011-02-11 Test-B 53 5
>2011-02-11 Test-C 17 1
>2011-02-10 Test-A 12 =I3 1 =J
>2011-02-10 Test-B 02 0
>2011-02-10 Test-C 54 5
Three kinds of test conducted in random fashions in a same day; but for this case date is not much important; only last three test records are used for the calculation. I am trying to perform sequential calculations as below; using 3rd oldest element. for example, for test A, I(iteration) will be 48 (3rd oldest record = column c3) and therefore R2 & R3 will be calculated based on I2 & I3. And at last displaying average of, R,R2,R3 - J. ( C4 = latest record. )
Expected result:
>Table:Test-A
>SR Date I I2 I3 I4
>-- ---------- ----- ----------- ----------- -------------------
>1 2011/02/17 48 -52.96 -24.18 -10.71
>Formula:
>SR Date R R2 R3 R4
>-- ---------- ----- ----------- ----------- -------------------
>1 today() 48=C3 (I*0.23-I2) (I*0.23-I3) =avg(I,I1,I2,I3)-C4
I guess I need to use sub/nested query with join, but i couldn't able to figure out how to handle I; all result will be placed in individual test tables. Your input will be much appreciated. TIA