Strong Like Bull
Strong Like Bull

Reputation: 11317

Group By in Cypher

Having "player" nodes in a Neo4j instance, I am interested to find all players that have the same name and a different shirt number. Basically a SQL group BY of player name and player jersey number.

Any tips?

thanks

Upvotes: 2

Views: 1455

Answers (1)

Thomas Fenzl
Thomas Fenzl

Reputation: 4392

The aggregation you want can be achieved by collect.

 START n = node(*) 
 RETURN n.name, collect(n.tshirt_number)

I made a small example graph:

http://console.neo4j.org/r/1vfeug

Upvotes: 6

Related Questions