Top 20 players per game

I have a query that return a count of game played per game. I now wish to sort and limit the result; so tha t i have the top 20 players per game.

Here is the query so far.

query (func: has( @groupBy([GameActivityReplica.replicatesPlayIn, GameActivityReplica.replicatesActivityOf]){
		gcount: count(uid)

Any help on getting this ordered and limited to the top 20 will be appreciated.

Have you checked out the documentation for those two operations?

Many thanks. I have learned so much from that,