0

The code below inside the QUERY() spreadsheet function doesn't seem to work as expected!

=QUERY(...., "Select E, I, count(H) group by E, I order by count(H) desc limit 10")

Result: Overall Top 10 rows based on Count(H)

Expected/Looking for: Top 10 rows "for each group" (E,I)

Any ideas/suggestions would be helpful. Thanks

Rubén
  • 34,714
  • 9
  • 70
  • 166
zzyzx
  • 129
  • 2
  • 6
  • Just to be sure I understand well, you don't want to `count` H, you just want to sort by the number in column H? (since you say you want the top 10 of each group, I assume you don't want to group the value of each group) – Liora Haydont May 08 '18 at 17:08
  • That's correct. Its like finding top 10 Students from each Class and for each Subject. Thanks so much for your advice in advance! – zzyzx May 10 '18 at 05:47
  • Thank you Rubèn for editing the code! – zzyzx May 10 '18 at 05:48
  • 1
    ...Try `=SORTN()` – TheMaster May 10 '18 at 08:23

0 Answers0