Hello, I was trying to get only the TOP RANKED rows from a table like this, using a query.
Here is my data:
The result would be a table showing only the yellow shaded rows, which are those where the "fruit count" is the highest.
I tried with a "group by max", but as expected I do not get what I am looking for.
E.G. I get "London Pear 9" because Pear is max value and 9 is max value.
Similarly I get wrong results if I try to "group by first", because the data in the original table are not ordered.
Additionally, in case of ties for the first position, I would like to get the fruit value that comes first in a separate table like the following.
9 Pear
8 Orange
7 Banana
6 Apple
5 Kiwi
4 Mango
3 Peach
So for example correct results would be
Budapest Pear 7 (because Pear is higher than Peach)
and
Paris Banana 19 (because Banana is higher than Apple)
I am assuming you would need to run a couple layers of query for the result, but I am not finding the solution.
I attached an excel file with the basic data for this question.
Thanks for helping out!
-abq-
Here is my data:
The result would be a table showing only the yellow shaded rows, which are those where the "fruit count" is the highest.
I tried with a "group by max", but as expected I do not get what I am looking for.
E.G. I get "London Pear 9" because Pear is max value and 9 is max value.
Similarly I get wrong results if I try to "group by first", because the data in the original table are not ordered.
Additionally, in case of ties for the first position, I would like to get the fruit value that comes first in a separate table like the following.
9 Pear
8 Orange
7 Banana
6 Apple
5 Kiwi
4 Mango
3 Peach
So for example correct results would be
Budapest Pear 7 (because Pear is higher than Peach)
and
Paris Banana 19 (because Banana is higher than Apple)
I am assuming you would need to run a couple layers of query for the result, but I am not finding the solution.
I attached an excel file with the basic data for this question.
Thanks for helping out!
-abq-