donnie_darko
New member
- Local time
- Today, 11:04
- Joined
- May 12, 2011
- Messages
- 7
Hi...first time poster so be gentle 
I have a table in the following format:
Code1 Code2 Reserve
1 5 678
1 9 23
......
Code1 takes values from 1 to 945 and Code2 takes values from 1 to 3000 (the table has 945*3,000=2,835,000 lines)
I need to summarise by Code1 for the average of the highest 150 Reserve values for each Code1 i.e. a table like:
Code1 Reserve
1 587
2 456
...
945 673
(e.g. 587 is the average of the highest 150 Reserve values for Code1)
Anyone have any ideas how to do this in a query? I tried messing about with SELECT TOP but couldn't get the right syntax.
Thanks in advance.

I have a table in the following format:
Code1 Code2 Reserve
1 5 678
1 9 23
......
Code1 takes values from 1 to 945 and Code2 takes values from 1 to 3000 (the table has 945*3,000=2,835,000 lines)
I need to summarise by Code1 for the average of the highest 150 Reserve values for each Code1 i.e. a table like:
Code1 Reserve
1 587
2 456
...
945 673
(e.g. 587 is the average of the highest 150 Reserve values for Code1)
Anyone have any ideas how to do this in a query? I tried messing about with SELECT TOP but couldn't get the right syntax.
Thanks in advance.