I have the following nodes:
p:Person
s:Skill
And the relationship is: (p)-[KNOWS]-(s).
My query is:
MATCH (p:Person)-[r:KNOWS]->(s:Skill) 
WHERE p.Name=~'Julie.*' 
RETURN (p.Name),(s.Name)
The Output is:
╒════════════╤══════════════════════════════╕
│(p.Name)    │(s.Name)                      │
╞════════════╪══════════════════════════════╡
│Julie Rocha │Knowledge Management          |
├────────────┼──────────────────────────────┤
│Julie Rocha │MongoDB                       │
└────────────┴──────────────────────────────┘
The Desired Output is:
╒════════════╤══════════════════════════════╕
│(p.Name)    │(s.Name)                      │
╞════════════╪══════════════════════════════╡
│Julie Rocha │Knowledge Management, MongoDB |
└────────────┴──────────────────────────────┘
How can I accomplish this? Any help is appreciated!
Use collect():
MATCH (p:Person)-[r:KNOWS]->(s:Skill) 
WHERE p.Name =~ 'Julie.*' 
RETURN p.Name, collect(s.Name) AS skill
In the result, the skill attribute will be a list.
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