title: select top x by group in ms access
body: <p>I have a dataset like this</p>
  <pre><code>A  B  Group  Index
  1  3   G1        25
  1  3   G1        23
  1  3   G1        99
  4  5   G2        6
  4  5   G2        8
  4  5   G2        10
  4  5   G2        2
  4  5   G2        4
  </code></pre>
  <p>Ideal output is to pick <strong>top x rows for each group with a descending order for <code>Index</code></strong></p>
  <pre><code>Group  Index
  G1      23
  G2      6
  G2      8
  G2      2
  G2      4
  </code></pre>
  <ul>
  <li>For each distinct value in <code>Group</code>, values of <code>A</code> and <code>B</code> are identical for all rows.</li>
  <li><code>B</code> indicates how many rows in the dataset. E.g. we have 3 rows for G1.</li>
  <li><code>A</code> indicates how many rows needed for output. E.g. in the output only one row with lowest value of <code>Index</code> exists for G1 and 4 rows for G2</li>
  </ul>
  <p>Can anyone shed some light on how to deal with this?</p>