I have a database in which each record has a `grade` and is associated to a certain `group`.   

I need to select the best `grades` in each `group`, not the usual top 5, but a different number in each `group`.

In the following example, there are `10 records` and `two groups`- `A` and `B`.

I want the highest 2 grades in `group A` and the highest 3 in `group B`:

```
ID  Group   Grade
1     A      4
2     B      2
3     B      4
4     A      7
5     A      8
6     A      5
7     B     10
8     B      3
9     B      9
10    A      7

```

The query should select records 4 and 5 of group A and records 3, 7 and 9 in group B.

I will appreciate any ideas to make this query.

Regards