I need to group the data from a neo4j database and then to filter out everything except the top n
records of every group.
Example:
I have two node
Use LIMIT
combined with ORDER BY
to get the top N of anything. For example, the top 5 scores would be:
MATCH (node:MyScoreNode)
RETURN node
ORDER BY node.score DESC
LIMIT 5;
The ORDER BY
part ensures the highest scores show up first. The LIMIT
gives you only the first 5, which since they're sorted, are always the highest.