I have the following table in Oracle:
category group lift
Apples Lemons 8
Apples Oranges 7
Apples Bananas 9
Apples Watermelon 7.5
Oranges Pineapple 6
Oranges Apples 2.5
Oranges Lemons 4
Oranges Strawberries 5.5
In real life, the category field contains too many rows for Apples and Oranges. What I want to do is to choose the distinct categories and the top 3 groups (group field) that correspond to the largest lifts for each category. Like this:
category group lift
Apples Bananas 9
Apples Lemons 8
Apples Watermelon 7.5
Oranges Pineapple 6
Oranges Strawberries 5.5
Oranges Lemons 4
As you see, I want to do a sort of "Group by" but not with any numerical metric. I just want to choose top 3 groups per category according to lift ordering.
Any ideas about how to this in Oracle?
Thanks in advance!