iID ParentID Col 10 Col 13 1 22 39.5 5.936 2 22 39.5 6.002 3 22 39.5 6.027 4 22 43.5 6.078 5 22 39.5 6.106Of the above I have to avg() col 13 based on the first reading of col 10 upto the readings of col 10 which are constant, but nothing after the breakage. ie. I have to avg(5.936, 6.002, 6.027) but not to avg 6.106 though col 10 equals to the first value. This is a child of the parent-child so I also have to take care of subset to ParentID 22 only as in this case.