the records are look like this:
|branch||doctor||days from today||free time minutes|
by branch and doctor I need to show the average(avg) of the closest X free turn larger then Y minutes
for example for
doc a in branch a its (1+2+2)/3=1.66 (1=its for the second row,2+2 its the next two chunks of 30 min from the row of 90 minutes free.
for doc c in branch b its (1+1+2)/3=1.3
for doc d in branch b its (4+4+4)/3=4
X and Y are input fields!!
and can be changed by the user online.
so whay needed is accumulative calculations on the fly on this records...
to get the results like this:
|branch||doctor||average free day from today|
you can imagine that the real data is thousands of doctors and like handers of branches...
thanks for any help