Using the Neo4j's console, I have the following graph
I'm trying to query the graph to get 2 rows, 1 for each player, but this is what I have
How to combine the rows such that for Player 36
, I only get 1, with a collection of Season
and each Season
has a collection of Month
.
Here is a solution that I think satisfies your requirement. This just takes your query and adds an interim step of aggregating the season and the months together in a map as a season. Then it collects the new compound season into seasons per player.
match (p:Player)-->(s:Season)-->(m:Month)
with p, {season: s, months: collect(m)} as season
return p, collect(season) as seasons
edit: applied cybersam's sage advice
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With