larrydavid
Programmer
Hello,
Based on these table values, I am trying to do a select to display a yearly average for each ID:
Instead of this existing ratio, it would be the yearly AVG of this [TestRatio] for each ID group, along with other fields (ID, NAME, Address, etc.).
I know the overall average would be calculated as: AVG([TestRatio]) * 1.0 , but I am not quite sure how to group this for each ID group. I've tried some outer queries and I think I'm close, but not quite there. So, the output I am trying to get is:
As always, any help is greatly appreciated and learned from.
Thanks,
Larry
Based on these table values, I am trying to do a select to display a yearly average for each ID:
Code:
ID TestRatio Year Month MonthName
111111111 50.000000000000 2011 1 Jan 2011
111111111 27.000000000000 2011 2 Feb 2011
111111111 35.000000000000 2011 3 Mar 2011
111111111 45.000000000000 2011 4 Apr 2011
222222222 25.000000000000 2011 1 Jan 2011
222222222 25.000000000000 2011 2 Feb 2011
222222222 40.000000000000 2011 3 Mar 2011
222222222 23.000000000000 2011 4 Apr 2011
333333333 12.000000000000 2011 1 Jan 2011
333333333 45.000000000000 2011 2 Feb 2011
333333333 67.000000000000 2011 3 Mar 2011
333333333 15.000000000000 2011 4 Apr 2011
Instead of this existing ratio, it would be the yearly AVG of this [TestRatio] for each ID group, along with other fields (ID, NAME, Address, etc.).
I know the overall average would be calculated as: AVG([TestRatio]) * 1.0 , but I am not quite sure how to group this for each ID group. I've tried some outer queries and I think I'm close, but not quite there. So, the output I am trying to get is:
Code:
ID TestRatioYearlyAVG Year
111111111 43.000000000000 2011
222222222 28.000000000000 2011
333333333 37.000000000000 2011
As always, any help is greatly appreciated and learned from.
Thanks,
Larry